v0.10.18a - Various fixes

This commit is contained in:
frederikpyt
2020-08-31 13:20:49 +02:00
parent 56cdd63fbb
commit f29fe0180a
3 changed files with 24 additions and 8 deletions
@@ -32,12 +32,17 @@ class EventController extends Controller
*/
public function index(Request $request)
{
DB::table('user_events')
->where('event_id')
->delete();
DB::table('events')
->where('events.date', '<=', date('Y-m-d H:i', strtotime('-1 day')))
->delete();
$eventsToDelete = DB::table('events')
->where('events.date', '<=', date('Y-m-d H:i', strtotime('-1 day')))->get();
foreach ($eventsToDelete as $event)
{
DB::table('user_events')
->where('event_id', '=', $event->id)
->delete();
$event->delete();
}
$events = Event::query()->orderBY('date' , 'asc')->paginate($request->input("limit", 20));
@@ -61,7 +66,7 @@ class EventController extends Controller
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return \Illuminate\Http\RedirectResponse
*/
public function store(Request $request)
{
@@ -102,7 +107,6 @@ class EventController extends Controller
return redirect()->route('events.index', ['events' => $events]);
}
}
/**