当前位置: 首页>>代码示例>>PHP>>正文


PHP Event::latest方法代码示例

本文整理汇总了PHP中app\Event::latest方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::latest方法的具体用法?PHP Event::latest怎么用?PHP Event::latest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Event的用法示例。


在下文中一共展示了Event::latest方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $lastPosts = Post::latest()->take(2)->get();
     $lastEvents = Event::latest()->take(2)->get();
     $lastEvents2 = Event::latest()->skip(2)->take(2)->get();
     return view('welcome')->with('lastPosts', $lastPosts)->with('lastEvents', $lastEvents)->with('lastEvents2', $lastEvents2);
 }
开发者ID:Zizazao,项目名称:evolutizalocal,代码行数:12,代码来源:indexController.php

示例2: postFinancialStatus

 public function postFinancialStatus(Request $request)
 {
     $data = $request->all();
     $latest = FinancialStatus::latest('created_at')->first();
     $event_id = Event::latest('id')->first()->id;
     $head_id = Head::where('event_id', $event_id)->where('position', 'Finance Committee Head')->first()->id;
     $data['weekly_income'] = $data['cash_in'] - $data['cash_out'];
     $data['cash_in_hand'] = $latest->cash_in_hand + $data['weekly_income'];
     $data['target_budget'] = $latest['target_budget'];
     $data['event_id'] = $event_id;
     $data['head_id'] = $head_id;
     FinancialStatus::create($data);
     return redirect("/");
 }
开发者ID:zoekayvee,项目名称:YSESTracker,代码行数:14,代码来源:HomeController.php

示例3: getIndex

 public function getIndex()
 {
     $users = User::all();
     $user = $this->getUser();
     $curr_event = Event::latest('id')->first();
     $all_comm = Committee::all();
     $committees = Committee::where('event_id', $curr_event->id)->get();
     $comm_array = Committee::where('event_id', $curr_event->id)->get(array('id'))->toArray();
     $events = Event::all();
     $tasks = Task::where('assigned_to', $user['id'])->whereIn('comm_id', $comm_array)->get();
     //tasks assigned to current user
     $all_tasks = Task::all();
     $categories = array('Pending', 'In-progress', 'Delayed', 'Finished');
     $comments = Comment::all();
     //get current event id
     $curr_event_id = $curr_event->id;
     //check if current user is upper head
     //get all heads of current event
     $heads = Head::where('event_id', $curr_event_id)->where('user_id', $user->id)->get();
     //get all comm_id(as array) in the current event where current user is a head
     $heads_comm = Head::where('event_id', $curr_event_id)->where('user_id', $user['id'])->get(array('comm_id'))->toArray();
     //members of committee
     $mem = Member::whereIn('comm_id', $heads_comm)->get(array('user_id'))->toArray();
     $members = User::whereIn('id', $mem)->get();
     //get all committees in the current event where current user is a head
     $head_committees = Committee::whereIn('id', $heads_comm)->get();
     //current user is a head
     $heads_comm = Head::where('user_id', $user['id'])->get();
     //committees where current user is a member
     $mem_comm = Member::where('user_id', $user['id'])->get();
     $url = "pages/profile";
     //check if curret user is admin
     if ($user->id == 1) {
         return redirect('/admin/');
     }
     //check if current user is OAH
     if ($curr_event->oah_id == $user->id) {
         $url = "pages/oah";
     }
     //return heads page if user is lower head
     if ($heads != "[]") {
         $url = "pages/heads";
     }
     if ($user->standing == "unconfirmed") {
         $url = "pages/oops";
     }
     return view($url, compact('users', 'user', 'events', 'curr_event', 'all_comm', 'committees', 'tasks', 'all_tasks', 'categories', 'comments', 'head_committees', 'heads_comm', 'mem_comm', 'members'));
 }
开发者ID:zoekayvee,项目名称:YSESTracker,代码行数:48,代码来源:ProfileController.php

示例4: getTask

 function getTask()
 {
     $user = \Auth::user();
     $events = Event::all();
     $event = Event::latest('id')->first();
     $tasks = Task::all();
     $categories = array('Pending', 'In-progress', 'Delayed', 'Finished');
     //Array of head->id of user
     $heads_comm = Head::where('event_id', $event->id)->where('user_id', $user->id)->get(array('comm_id'))->toArray();
     //members of committee
     $mem = Member::whereIn('comm_id', $heads_comm)->get(array('user_id'))->toArray();
     $members = User::whereIn('id', $mem)->get();
     //committees where user is head
     $committees = Committee::whereIn('id', $heads_comm)->get();
     return view('pages/task', compact('user', 'members', 'events', 'event', 'committees', 'tasks', 'categories'));
 }
开发者ID:zoekayvee,项目名称:YSESTracker,代码行数:16,代码来源:TaskController.php

示例5: getBalance

 public function getBalance()
 {
     $user = \Auth::user();
     $curr_event = Event::latest('id')->first();
     $is_head = Head::where('event_id', $curr_event->id)->where('user_id', $user->id)->first();
     if ($is_head->position == "Finance Committee Head") {
         $is_head = true;
     } else {
         $is_head = false;
     }
     if (!$is_head) {
         return redirect("/");
     }
     $users = User::where('standing', 'active')->oldest('lname')->get();
     return view('pages/finance', compact('user', 'users'));
 }
开发者ID:zoekayvee,项目名称:YSESTracker,代码行数:16,代码来源:FinanceController.php

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $events = Event::latest()->get();
     return view('events.events', compact('events'));
 }
开发者ID:Zizazao,项目名称:evolutizalocal,代码行数:10,代码来源:eventsController.php

示例7: currentEvent

 private function currentEvent()
 {
     return Event::latest('id')->first();
 }
开发者ID:zoekayvee,项目名称:YSESTracker,代码行数:4,代码来源:AdminController.php

示例8: events

 public function events()
 {
     $events = Event::latest('date')->get();
     $steminars = Steminar::latest('date')->get();
     return view('main.events', compact('events', 'steminars'));
 }
开发者ID:NuLeaf,项目名称:nuleaf-website,代码行数:6,代码来源:MainController.php

示例9: getList

 /**
  * get all users in a list for a select box
  * @return mixed
  */
 public function getList()
 {
     return $this->model->latest('created_at')->lists('name', 'id');
 }
开发者ID:iris-it,项目名称:irispass-webapp-laravel,代码行数:8,代码来源:UserRepository.php

示例10: index

 public function index()
 {
     $events = Event::latest()->where('name', 'settle')->paginate(20);
     return view('admin.credit.settle.index', compact('events'))->with(['title' => 'Settlement Management']);
 }
开发者ID:emadmrz,项目名称:Hawk,代码行数:5,代码来源:EventController.php

示例11: index

 /**
  * List all the current events
  *
  * @return $this
  */
 public function index()
 {
     // Get all the events
     $events = Event::latest()->published()->get();
     return view('events.index')->with('events', $events);
 }
开发者ID:rachelglover,项目名称:entries,代码行数:11,代码来源:EventsController.php

示例12: team

 public function team()
 {
     $lastSliders = Slider::latest()->take(1)->get();
     $lastPosts = Post::latest()->take(2)->get();
     $lastEvents = Event::latest()->take(2)->get();
     $title = 'Equipo';
     $lastEvents2 = Event::latest()->skip(2)->take(2)->get();
     return view('guest.team')->with('title', $title)->with('lastPosts', $lastPosts)->with('lastEvents', $lastEvents)->with('lastEvents2', $lastEvents2)->with('lastSliders', $lastSliders);
 }
开发者ID:Zizazao,项目名称:evolutizalocal,代码行数:9,代码来源:guestController.php

示例13: store

 /**
  * Store a newly created event in the events table.
  *
  * @param  \Illuminate\Http\Request  $input
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $messages = ['date_format' => 'The start time does not match the format HH:MM:SS'];
     //Validates the input from the create event page
     $this->validate($request, ['name' => 'required|max:40', 'venue' => 'required|max:30', 'city' => 'required|max:30', 'price' => 'required|numeric', 'information' => 'required|max:255', 'description' => 'required', 'capacity' => 'required|numeric', 'date' => 'required|date', 'start_time' => 'required|date_format:H:i:s', 'end_time' => 'required|date_format:H:i:s', 'image' => 'image|required'], $messages);
     //adds all the data from the create events page to the database in the events table
     $name = $request->input('name');
     $venue = $request->input('venue');
     $city = $request->input('city');
     $price = $request->input('price');
     $information = $request->input('information');
     $description = $request->input('description');
     $capacity = $request->input('capacity');
     $date = $request->input('date');
     $start_time = $date . ' ' . $request->input('start_time');
     $end_time = $date . ' ' . $request->input('end_time');
     $image = 'image';
     echo $end_time;
     Event::create(['name' => $name, 'venue' => $venue, 'city' => $city, 'price' => $price, 'information' => $information, 'description' => $description, 'capacity' => $capacity, 'date' => $start_time, 'end_time' => $end_time, 'image' => $image]);
     //gets the id of the event above and concats it to the file extension of the image uploaded.
     $name = Event::latest()->first()->id . "." . Input::file('image')->getClientOriginalExtension();
     //gets the event ID and concat on the imaage file extension that was uploaded
     //moves and renames the image selected from a temp directory to the event_images folder as
     Input::file('image')->move(public_path() . '/img/event_images', $name);
     //moves the uploaded image from the tmp directory to a premanant one (/public/img/event_images) and renames it to <eventID>.<fileExt>
     $image = Event::latest()->first();
     //returns the latest event added to the table (the one just added above)
     $image->image = $name;
     //adds the image name from above to the image column of the latest event
     $image->save();
     //saves the above action
     return redirect('events');
     //redirects to events view when finished
 }
开发者ID:xRokco,项目名称:websysproject,代码行数:40,代码来源:AdminController.php

示例14: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $events = Event::latest('date')->paginate(10);
     return view('cp.events.index', compact('events'));
 }
开发者ID:NuLeaf,项目名称:nuleaf-website,代码行数:10,代码来源:EventsController.php


注:本文中的app\Event::latest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。