app/Http/Controllers/AdminEventController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index()
    {
        $events = Event::where('end_date','>',Carbon::today())->orderBy('start_date')->paginate(5);
        $event_type = 'admin';
        $events_all = Event::all();
        $events_json = [];
        foreach ($events_all as $event)
        {
            $start_date = new Carbon($event['start_date']);
            $end_date = new Carbon($event['end_date']);
            $start = [
                'y' => $start_date->year,
                'm' => $start_date->month-1,
                'd' => $start_date->day,
                'h' => true,
            ];
            $end = [
                'y' => $end_date->year,
                'm' => $end_date->month-1,
                'd' => $end_date->day,
                'h' => true,
            ];
            $events_json[] = [
                'start' => $start,
                'end' => $end,
                'state' => $event->event_status['color'],
                'id' => $event->id
            ];
        }
        return view('admin.events.index', compact('events', 'event_type', 'events_json'));
    }
public function index ( ) { $ events = Event :: where ( 'end_date' , '>' , Carbon :: today ( ) ) -> orderBy ( 'start_date' ) -> paginate ( 5 ) ; $ event_type = 'admin' ; $ events_all = Event :: all ( ) ; $ events_json = [ ] ; foreach ( $ events_all as $ event ) { $ start_date = new Carbon ( $ event [ 'start_date' ] ) ; $ end_date = new Carbon ( $ event [ 'end_date' ] ) ; $ start = [ 'y' => $ start_date -> year , 'm' => $ start_date -> month - 1 , 'd' => $ start_date -> day , 'h' => true , ] ; $ end = [ 'y' => $ end_date -> year , 'm' => $ end_date -> month - 1 , 'd' => $ end_date -> day , 'h' => true , ] ; $ events_json [ ] = [ 'start' => $ start , 'end' => $ end , 'state' => $ event -> event_status [ 'color' ] , 'id' => $ event -> id ] ; } return view ( 'admin.events.index' , compact ( 'events' , 'event_type' , 'events_json' ) ) ; }
Display a listing of the resource.
Display a listing of the resource .
//