當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Event::where方法代碼示例

本文整理匯總了PHP中app\Event::where方法的典型用法代碼示例。如果您正苦於以下問題:PHP Event::where方法的具體用法?PHP Event::where怎麽用?PHP Event::where使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Event的用法示例。


在下文中一共展示了Event::where方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: index

 public function index()
 {
     if (Auth::guest()) {
         return view('pages.home');
     }
     //Check to make sure gender and names are populated
     $user = Auth::user();
     $fields = ['first_name' => $user->first_name, 'last_name' => $user->last_name, 'gender' => $user->gender];
     $validation = Validator::make($fields, User::$baseRules);
     if (!$validation->passes()) {
         return redirect('user/name-and-gender');
     }
     //Check to make sure user has choson categories
     if (!$this->categoryAccount->where('user_id', $user->id)->first()) {
         return redirect('user/categories');
     }
     $chosenCategories = $this->categoryAccount->where('user_id', Auth::user()->id)->orderByRaw('RAND()')->get();
     //Get one random task for the "one for the road"
     $oneForTheRoad = array();
     foreach ($chosenCategories as $category) {
         $events = $this->event->where('type', $category->category_id)->orderByRaw('RAND()')->get();
         foreach ($events as $event) {
             if (!$this->eventUser->where('event_id', $event->id)->where('user_id', Auth::user()->id)->first() && !$this->eventUser->where('user_id', Auth::user()->id)->where('created_at', '<=', date('Y-m-d 24:00:00'))->where('created_at', '>=', date('Y-m-d 00:00:00'))->where('complete', 1)->first()) {
                 array_push($oneForTheRoad, ['id' => $event->id, 'name' => $event->name, 'description' => $event->description, 'class' => 'active']);
             } else {
                 array_push($oneForTheRoad, ['id' => '0', 'name' => 'None for today!', 'description' => 'One for the road has completed', 'class' => 'inactive']);
             }
         }
     }
     $category = $this->category;
     return view('pages.dashboard', compact('category', 'chosenCategories', 'oneForTheRoad'));
 }
開發者ID:OrvilSavery,項目名稱:spontanunity,代碼行數:32,代碼來源:PagesController.php

示例2: Home

 public function Home()
 {
     $flash = Event::where('start_date', '<=', new \Datetime())->where('end_date', '>=', new \Datetime())->orderBy('id', 'desc')->take(1)->get()->first();
     $articles = Article::where('id', '!=', isset($flash) ? $flash->article->id : 0)->orderBy('publish_at', 'desc')->orderBy('id', 'desc')->take(5)->get();
     $ffttNews = FFTTNew::orderBy('date', 'desc')->take(3)->get();
     return view('front.home', array('articles' => $articles, 'NewsFlash' => $flash, 'ffttNews' => $ffttNews));
 }
開發者ID:kbiyo,項目名稱:ARTTv2,代碼行數:7,代碼來源:HomeController.php

示例3: delete

 public function delete($id)
 {
     \App\Event::where('id', $id)->delete();
     \App\EventMedia::where('eventID', $id)->delete();
     \App\EventTag::where('eventID', $id)->delete();
     return redirect('/');
 }
開發者ID:erikkacsm,項目名稱:timeline,代碼行數:7,代碼來源:EventController.php

示例4: getCalendar

 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'));
 }
開發者ID:TeDyGuN,項目名稱:SIS-EAEN,代碼行數:7,代碼來源:FullCalendarController.php

示例5: postTask

 function postTask(Request $request)
 {
     $task = $request->all();
     Task::create($task);
     $comm = Committee::where('id', $task['comm_id'])->first();
     $evnt = Event::where('id', $comm['event_id'])->first();
     //UPDATING WEIGHT OF COMMITTEE AND EVENT
     $comm->increment('weight', $task['weight']);
     $evnt->increment('weight', $task['weight']);
     //UPDATING PROGRESS OF COMMITTEE
     $progress = 0;
     $tasks = Task::where('comm_id', $comm->id)->get();
     foreach ($tasks as $task1) {
         $progress += $task1->weight * $task1->progress;
     }
     $progress = $progress / $comm->weight;
     $comm->progress = $progress;
     $comm->save();
     //UPDATING PROGRESS OF EVENT
     $progress2 = 0;
     $committees = Committee::all();
     foreach ($committees as $committee) {
         if ($committee->event_id == $evnt->id) {
             $progress2 += $committee->weight * $committee->progress;
         }
     }
     $progress2 = $progress2 / $evnt->weight;
     $evnt->progress = $progress2;
     $evnt->save();
     return redirect('profile');
 }
開發者ID:zoekayvee,項目名稱:YSESTracker,代碼行數:31,代碼來源:TaskController.php

示例6: down

 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     $city = City::findByIATA('nyc')->first();
     $event = Event::where('city_id', '=', $city->id);
     $city->delete();
     $event->delete();
 }
開發者ID:EMT,項目名稱:see-do,代碼行數:12,代碼來源:2016_02_16_114627_seed_nyc_testing_city_and_event.php

示例7: index

 /**
  * Render front page view
  * @return VIEW welcome
  */
 public function index()
 {
     $all_events = Event::where('time', '>', date('Y-m-d H:i:s'))->orderBy(DB::raw('RAND()'));
     $first_six = $all_events->take(6)->get();
     $next_six = $all_events->skip(6)->take(6)->get();
     return View::make('welcome')->with('first_six', $first_six)->with('next_six', $next_six);
 }
開發者ID:boregan,項目名稱:lowdown,代碼行數:11,代碼來源:UserController.php

示例8: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $cities = City::all();
     // Grab all the cities and then do a for each.
     // run this for each of them.
     foreach ($cities as $city) {
         $events = Event::where('city_id', '=', $city->id)->where('time_end', '>=', date('Y-m-d H:i:s'))->where('time_end', '<=', date('Y-m-d H:i:s', strtotime('+2 weeks')))->orderBy('time_start', 'asc')->get();
         if (!count($events)) {
             $this->comment('No events found for ' . $city->name . '. Mailer not sent.');
             continue;
         }
         $categories = Category::orderBy('title', 'asc')->get();
         if ($this->option('email')) {
             $subscriber = new Subscriber();
             $subscriber->name = 'Test User';
             $subscriber->email = $this->option('email');
             $subscribers = [$subscriber];
             $this->comment('Sent test email to ' . $this->option('email'));
         } else {
             $subscribers = Subscriber::where('city_id', '=', $city->id)->get();
         }
         $count = 0;
         foreach ($subscribers as $subscriber) {
             Mail::send('emails.subscribers.mailer', ['subscriber' => $subscriber, 'events' => $events, 'categories' => $categories, 'city' => $city], function ($m) use($subscriber, $city) {
                 $m->from('messages@madebyfieldwork.com', 'See+Do')->to($subscriber->email, $subscriber->name)->subject('Weekly Round-Up of Things to See+Do in ' . $city->name)->getHeaders()->addTextHeader('X-MC-Subaccount', 'see-do');
             });
             $count++;
         }
         $this->comment('Sent to ' . $count . ' email addresses in ' . $city->name . '.');
         $count = 0;
     }
 }
開發者ID:EMT,項目名稱:see-do,代碼行數:37,代碼來源:SendMailer.php

示例9: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     // Same time next week! :D
     $job = (new \App\Jobs\WeeklyMail())->delay(604800);
     $this->dispatch($job);
     // We'll just want to double-check our Facebook events still exist
     // before we email people about them...
     FacebookSession::setDefaultApplication(getenv('FB_ID'), getenv('FB_SECRET'));
     $session = FacebookSession::newAppSession();
     try {
         $session->validate();
     } catch (FacebookRequestException $ex) {
         // Session not valid, Graph API returned an exception with the reason.
         dd($ex);
     } catch (\Exception $ex) {
         // Graph API returned info, but it may mismatch the current app or have expired.
         dd($ex);
     }
     $all_events = Event::where('time', '>', date('Y-m-d H:i:s'))->where('time', '<', date('Y-m-d H:i:s', time() + 604800))->get();
     foreach ($all_events as $event) {
         $request = new FacebookRequest($session, 'GET', "/" . $event->facebook_id);
         try {
             $response = $request->execute();
         } catch (\Exception $ex) {
             // Facebook Exception looking up event; probably deleted, should mirror here.
             $event->delete();
         }
     }
     foreach (User::where('unsubscribed_email', 'no') as $user) {
         $this->dispatch(new SendEmail($user));
     }
 }
開發者ID:boregan,項目名稱:lowdown,代碼行數:37,代碼來源:WeeklyMail.php

示例10: editTimeline

 /**
  * Edit timeline /
  */
 public function editTimeline($timeline_id, Request $request)
 {
     $timeline = \App\Timeline::where('id', '=', $timeline_id)->first();
     $timeline_events = $timeline->event()->orderBy('start_date')->get();
     if ($request->input('showForm') == 'true') {
         return view('timelines.editTimeline')->with('showForm', 'true')->with('timeline', $timeline)->with('timeline_events', $timeline_events);
     } else {
         // Else submit form
         // Validate the request data
         $this->validate($request, ['name' => 'required']);
         $user = \Auth::user();
         $timeline->name = $request->input('name');
         $timeline->description = $request->input('description');
         $timeline->last_modified_by = $user->id;
         $timeline->save();
         // Delete events
         for ($e = 0; $e < count($timeline_events); $e++) {
             if ($request->input('delete_event' . $e) == 'true') {
                 \DB::table('character_event')->where('event_id', '=', $timeline_events[$e]->id)->delete();
                 \DB::table('event_location')->where('event_id', '=', $timeline_events[$e]->id)->delete();
                 $event = \App\Event::where('id', '=', $timeline_events[$e]->id)->first();
                 if ($event) {
                     $event->delete();
                 }
             }
         }
         // Return success message
         return view('timelines.editTimeline')->with('showForm', 'false')->with('timeline', $timeline);
     }
 }
開發者ID:andrewkramer,項目名稱:p4,代碼行數:33,代碼來源:TimelinesController.php

示例11: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($type, $id)
 {
     if ($id == 'video') {
         $events = Video::all();
         return view('video.show', compact('events'));
     } elseif ($id == 'staff') {
         $events = Staff::all();
         return view('staff.show', compact('events'));
     } elseif ($id == 'gallery') {
         $events = Image::all();
         return view('gallery.show', compact('events'));
     } else {
         $event = Event::where('slug', $id)->where('type', $type)->first();
         $location = Location::where('event_id', $event->id)->first();
         $slider = EventImage::where('event_id', $event->id)->orderBy(\DB::raw('RAND()'))->take(4)->get();
         $gallery = EventImage::where('event_id', $event->id)->first();
         if ($event->type == $type) {
             if ($event->status == 1) {
                 return view($type . '.show', compact('event', 'location', 'slider', 'gallery'));
             } else {
                 return redirect('/' . $type . '/');
             }
         }
     }
 }
開發者ID:heckyeah,項目名稱:ngaitauira,代碼行數:31,代碼來源:EventController.php

示例12: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $events = Event::where('user_id', $user_id)->get();
     $jobs = Job::where('user_id', $user_id)->get();
     // return view('members.dashboardpage', ['user' => $user, 'events' => $events, 'jobs' => $jobs]);
     return view('public.frontpage', ['user' => $user, 'events' => $events, 'jobs' => $jobs]);
 }
開發者ID:bituka,項目名稱:LaravelPHStaticPage,代碼行數:12,代碼來源:HomeController.php

示例13: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $slug = $request->route('slug');
     $event = Event::where(['slug' => $slug])->first();
     //dd(\Auth::user()->role);
     $role = \Auth::user()->role;
     return $next($request);
 }
開發者ID:elinadenfina,項目名稱:lazyNinjaEvents,代碼行數:15,代碼來源:EventAdmin.php

示例14: viewSingle

 public function viewSingle($id)
 {
     if (!Event::where('id', $id)->exists()) {
         return redirect('/');
     }
     $event = Event::where('id', $id)->first();
     return view('single', compact('event', 'title', 'events'));
 }
開發者ID:jacobimpson,項目名稱:bandkit,代碼行數:8,代碼來源:EventsController.php

示例15: tearDown

 protected function tearDown()
 {
     PollResponse::where('pid', $this->pollOption->oid)->delete();
     PollOption::where('oid', $this->pollOption->oid)->delete();
     Poll::where('pid', $this->poll->pid)->delete();
     Event::where('eid', $this->event->eid)->delete();
     User::where('uid', $this->user->uid)->delete();
 }
開發者ID:umSoftEng2GrpE,項目名稱:partEZ,代碼行數:8,代碼來源:PollResponsesTest.php


注:本文中的app\Event::where方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。