public function getCalendar() { $eventos = Event::select('titulo_evento')->where('user_id', '=', Auth::user()->id)->take(4)->get(); //$datos['cTrabajo']= \DB::table('trabajo')->count(); $array = Event::where('user_id', '=', Auth::user()->id)->get(); return view('Calendar/calendar', compact('array', 'datos', 'eventos')); }
public static function eventsUsuari($cultius) { if (!is_null($cultius)) { // foreach ($cultius as $cultiu){ // dd($cultiu); if (!is_null($cultius)) { $results = Event::select('id', 'headline', 'text', 'startDate', 'cultiu_id')->where(function ($query) use($cultius) { foreach ($cultius as $value) { if (!is_null($value)) { //you can use orWhere the first time, dosn't need to be ->where $query->orWhere('cultiu_id', $value['id']); } } })->orderBy('updated_at', 'desc')->get()->toArray(); foreach ($results as $passa) { $dades[] = $passa; } } //} } //dd($dades); if (!is_null($dades)) { return $dades; } }
public function events(Request $request) { if ($request->start && $request->end) { return Event::whereRaw("start between '" . $request->start . "' and '" . $request->end . "'")->with("order")->get(); } else { return Event::select("*")->get(); } }
/** * Display events that require CERFs. * * @return \Illuminate\View\View */ public function overview() { // Ensures only events created after implementation of online CERFs system are checked. $oldestAllowed = Carbon::create(2015, 11, 1, 8, 0, 0, 'UTC'); $newestAllowed = Carbon::now(); // Finds IDs of all events that do not have an associated approved CERF. $eventIdsWithoutCerfs = Event::select('events.id')->leftJoin('cerfs', 'events.id', '=', 'cerfs.event_id')->whereNull('cerfs.id')->orWhere('cerfs.approved', false)->get(); // TODO Paginate events that need to be CERFed. // Retrieves events without CERFs based on ID. Casts to array to pass to foreach loop in view. $eventsWithoutCerfs = Event::find($eventIdsWithoutCerfs->toArray()); $userCerfs = Cerf::where('reporter_id', Auth::id())->where('approved', false)->get(); return view('pages.cerfs.overview', compact('eventsWithoutCerfs', 'userCerfs', 'oldestAllowed', 'newestAllowed')); }
public function index() { /* Get data for timeline */ $eventDates = \App\Event::select('timelineDate')->distinct()->get()->pluck('timelineDate')->toArray(); $mediaDates = \App\Media::select('timelineDate')->distinct()->get()->pluck('timelineDate')->toArray(); $dates = array_unique(array_merge($eventDates, $mediaDates), SORT_REGULAR); usort($dates, array('\\App\\Http\\Controllers\\TimelineController', 'dateCompare')); $media = array(); $events = array(); foreach ($dates as $date) { $eventsForThisDate = \App\Event::get()->where('timelineDate', $date)->toArray(); $mediaForThisDate = \App\Media::get()->where('timelineDate', $date)->toArray(); usort($eventsForThisDate, array('\\App\\Http\\Controllers\\TimelineController', 'itemCompare')); usort($mediaForThisDate, array('\\App\\Http\\Controllers\\TimelineController', 'itemCompare')); $media[$date] = $mediaForThisDate; $events[$date] = $eventsForThisDate; } /* Get data for filters */ $mediums = \App\Media::select('medium')->distinct()->get()->pluck('medium')->toArray(); $tags = \App\EventTag::select('tag')->distinct()->get()->pluck('tag')->toArray(); $series = \App\Series::get()->pluck('seriesAbbreviation'); sort($mediums); sort($tags); $eventIDToTags = array(); $eventIDs = \App\Event::get()->pluck('id'); foreach ($eventIDs as $eventID) { $eventIDToTags[$eventID] = \App\EventTag::select('tag')->where('eventID', $eventID)->get()->pluck('tag')->toArray(); } $seriesToCollections = array(); foreach ($series as $thisSeries) { $seriesToCollections[$thisSeries] = \App\Media::select('collection')->where('series', $thisSeries)->distinct()->get()->pluck('collection')->toArray(); } /* Get event-media relationships */ $eventMediaPairs = \App\EventMedia::get(array('eventID', 'mediaID'))->toArray(); return view('timeline')->with(['seriesToCollections' => $seriesToCollections, 'eventMediaPairs' => $eventMediaPairs, 'eventIDToTags' => $eventIDToTags, 'mediums' => $mediums, 'events' => $events, 'dates' => $dates, 'media' => $media, 'tags' => $tags]); }
public function getTittlesEvents() { $eventos = Event::select('titulo_evento')->where('user_id', '=', Auth::user()->id)->take(4)->get(); return $eventos; }
/** * View a list of events. * @return mixed */ public function index() { $events = Event::select('events.*')->join('event_times', 'events.id', '=', 'event_times.event_id')->orderBy('event_times.start', 'DESC')->distinct()->distinctPaginate(15); $this->checkPagination($events); return View::make('events.index')->withEvents($events); }
/** * Show the form for editing an existing event's info. * * @param int $id * @return \Illuminate\Http\Response */ public function editEventInfo($id) { $event = Event::select('events.*')->where('id', '=', $id)->firstorfail(); return view('admin/edit', ['event' => $event]); }