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


PHP Event::orderBy方法代碼示例

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


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

示例1: welcome

 /**
  * Shows the homepage.
  *
  * @return \Illuminate\Http\Response
  */
 public function welcome()
 {
     //Gets a list of all events in a random order.
     $randEvent = Event::orderBy(DB::raw('RAND()'))->get();
     //returns the welcome view with the array of events from above.
     return view('welcome', ['randEvent' => $randEvent]);
 }
開發者ID:xRokco,項目名稱:websysproject,代碼行數:12,代碼來源:GuestController.php

示例2: store

 public function store(Request $request)
 {
     // Add new event
     $event = new Event();
     $event->name = $request->input('name');
     $event->date = $request->input('date');
     $this->selectVenue($request->input('venue'), $event);
     $event->save();
     //generate the filename
     $file_name = strtolower($event->id . '-' . $event->venue->slug . '-' . date_format($event->date, 'd-m-y'));
     // move the file
     if ($request->file('image')) {
         // resize and save
         $image = Image::make($request->file('image'));
         $image->resize(300, null, function ($constraint) {
             $constraint->aspectRatio();
         })->save(base_path() . '/public/img/posters/tn_' . $file_name);
         // save full sized also
         $request->file('image')->move(base_path() . '/public/img/posters/', $file_name);
     }
     // reselect the event..
     $event = Event::orderBy('created_at', 'desc')->first();
     if ($request->file('image')) {
         // add the image and save it
         $event->image = $file_name;
     }
     $event->save();
     if (isset($request['bands'])) {
         foreach ($request['bands'] as $band) {
             $band = Band::where('name', $band)->first();
             $event->band()->attach($band->id);
         }
     }
     return redirect()->back();
 }
開發者ID:jacobimpson,項目名稱:bandkit,代碼行數:35,代碼來源:EventsController.php

示例3: index

 public function index()
 {
     // Retrieve all events from the database
     // and order by earliest starting first
     $events = Event::orderBy('start_datetime', 'ASC')->get();
     //return the view of all events
     return view('events.index', ['events' => $events]);
 }
開發者ID:TheJokersThief,項目名稱:Eve,代碼行數:8,代碼來源:EventsController.php

示例4: dashboard

 public function dashboard()
 {
     $venues = Venue::orderBy('name', 'asc')->get();
     $bands = Band::orderBy('name', 'asc')->get();
     $events = Event::orderBy('date', 'asc')->get();
     $events_future = Event::futureEvents();
     $events_past = Event::pastEvents();
     return view('dashboard', compact('venues', 'events', 'events_future', 'events_past', 'bands'));
 }
開發者ID:jacobimpson,項目名稱:bandkit,代碼行數:9,代碼來源:BaseController.php

示例5: agenda

 public function agenda()
 {
     $events = Event::orderBy('endtime')->get();
     $pastevents = $events->filter(function ($item) {
         return $item->starttime->isPast();
     });
     $futureevents = $events->filter(function ($item) {
         return $item->starttime->isFuture();
     });
     return view('pages.public.agenda', compact('pastevents', 'futureevents', 'events'));
 }
開發者ID:svuvis,項目名稱:oshusite,代碼行數:11,代碼來源:PublicController.php

示例6: index

 /**
  * Show the admin dashboard.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //Gets all the event details from the event table
     $events = Event::orderBy('created_at', 'desc')->paginate(5, ['*'], 'events');
     $pastevents = Event::onlyTrashed()->orderBy('deleted_at', 'desc')->paginate(5, ['*'], 'past');
     //gets all messages from the messages table
     $messages = Message::join('users', 'users.id', '=', 'messages.userid')->select('users.name', 'users.email', 'messages.*')->whereNull('deleted_at')->orderBy('created_at', 'desc')->paginate(5, ['*'], 'messages');
     //gets all the read (deleted) messages from the messags table.
     $readMessages = Message::join('users', 'users.id', '=', 'messages.userid')->select('users.name', 'users.email', 'messages.*')->whereNotNull('deleted_at')->onlyTrashed()->orderBy('created_at', 'desc')->paginate(5, ['*'], 'read');
     //Returns the events view along with the $events, $messages and $readMessages arrays containing the query results from above
     return view('admin/admin', ['events' => $events, 'pastevents' => $pastevents, 'messages' => $messages, 'readMessages' => $readMessages]);
 }
開發者ID:xRokco,項目名稱:websysproject,代碼行數:17,代碼來源:AdminController.php

示例7: index

 public function index(Request $request)
 {
     if (!Auth::check()) {
         return response()->json($this->notLoginJson, 401);
     } else {
         $user = Auth::user();
         if (!$user->hasRole('user')) {
             return response()->json($this->needPermissionsJson, 401);
         }
     }
     $events = Event::orderBy('date', 'desc')->get();
     foreach ($events as $event) {
         $event->load('members');
         $event->loadResources();
     }
     return response()->json($events);
 }
開發者ID:pedronalbert,項目名稱:lions-server,代碼行數:17,代碼來源:EventController.php

示例8: update

 public function update(Request $request, $id)
 {
     if ($request->isMethod('get')) {
         $this->data['items'] = Event::orderBy('created_at', 'asc')->get();
         $this->data['questions'] = Question::get();
         $this->data['lala'] = Event::find($id);
         if ($this->data['lala']) {
             return view('pages.event.update', $this->data);
         } else {
             return redirect('event');
         }
     } elseif ($request->isMethod('post')) {
         $event = Event::find($id);
         $event->update($request->all());
         $event->question()->detach();
         if (isset($request->all()['questions'])) {
             $event->question()->sync($request->all()['questions']);
         }
         return redirect('event/detail/' . $id);
     }
 }
開發者ID:bilfash,項目名稱:monstaff,代碼行數:21,代碼來源:EventController.php

示例9: adminIndex

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function adminIndex()
 {
     $events = Event::orderBy('name')->with('bands', 'manager', 'article')->paginate(15);
     return view('admin.events.index', compact('events'));
 }
開發者ID:Techraav,項目名稱:PolyMusic,代碼行數:10,代碼來源:EventController.php

示例10: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $events = Event::orderBy('id', 'DESC')->get();
     return view('events.index', compact('events'));
 }
開發者ID:yodarian,項目名稱:epgp,代碼行數:10,代碼來源:EventsController.php

示例11: index

 public function index()
 {
     $events = Event::orderBy('event_time')->upcoming()->get();
     return view('events.all', compact('events'));
 }
開發者ID:getacked,項目名稱:project,代碼行數:5,代碼來源:EventsController.php

示例12: index

 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $events = Event::orderBy('when', 'asc')->get();
     return view('home', compact('events'));
 }
開發者ID:jaschweder,項目名稱:tcc,代碼行數:10,代碼來源:HomeController.php

示例13: index

 public function index()
 {
     //
     $events = Event::orderBy('created_at', 'DESC')->paginate(20);
     return view('admin.event.index', compact('events'));
 }
開發者ID:nutsdo,項目名稱:rp-wechat,代碼行數:6,代碼來源:EventController.php

示例14: homepage

 public function homepage()
 {
     $events = Event::orderBy('event_time')->get();
     return View::make('home', compact('events'));
 }
開發者ID:getacked,項目名稱:project,代碼行數:5,代碼來源:PagesController.php

示例15: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $events = Event::orderBy('endtime')->get();
     return view('pages.admin.events.index', compact('events'));
 }
開發者ID:svuvis,項目名稱:oshusite,代碼行數:10,代碼來源:EventsController.php


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