当前位置: 首页>>代码示例>>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;未经允许,请勿转载。