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


PHP Events::with方法代码示例

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


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

示例1: show

 public function show($id)
 {
     // init
     $event = Events::with(array('city', 'eventcategory', 'user'))->where('id', '=', $id)->orderBy('id', 'desc')->first();
     $data = array('menu' => $this->_menu, 'title' => 'Event - ' . $event->name, 'description' => '', 'breadcrumb' => array('Event' => route('admin.event'), $event->name => route('admin.event.show', $event->id)));
     if ($event == null) {
         return App::abort('404');
     }
     $data['event'] = $event;
     $social_action = SocialActionEvent::with(array('user', 'socialAction'))->where('event_id', '=', $event['id'])->orderBy('id', 'desc')->get();
     // Get category
     // $data['social_actions'] = $social_action;
     $sos = array();
     if (count($social_action) > 0) {
         foreach ($social_action as $val) {
             # code...
             $sos[] = $val['social_action'];
         }
         $data['social_actions'] = $sos;
         // Get Photos that related with this
         $data['photos'] = Photo::where('type_name', '=', 'social_actions')->where('type_id', '=', $social_action[0]->id)->orderBy('id', 'desc')->get();
     } else {
         $data['social_actions'] = array();
         $data['photos'] = array();
     }
     return View::make('admin.pages.event.show')->with($data);
 }
开发者ID:whiterun,项目名称:bagikasih-v2,代码行数:27,代码来源:AdminEventController.php

示例2: index

 public function index()
 {
     // init
     $data = array();
     // set offset & limit
     $limit = 8;
     $page = Input::has('page') ? Input::get('page') : 1;
     $offset = ($page - 1) * $limit;
     // get all categories
     $data['categories'] = EventCategory::where('status', '=', 1)->get();
     // get all cities
     $data['cities'] = City::where('status', '=', 1)->orderBy('name', 'asc')->get();
     // get input
     $input = Input::all();
     // get social actions
     $events = Events::with(array('city', 'category'))->where('status', '!=', 0);
     if (Input::has('q')) {
         // keyword
         $input['q'] = trim($input['q']);
         $events = $events->where('name', 'like', '%' . $input['q'] . '%');
     }
     if (Input::has('category') and Input::get('category') != 'all') {
         // category
         $events = $events->where('event_category_id', '=', $input['category']);
     }
     if (Input::has('city') and Input::get('city') != 'all') {
         // city
         $events = $events->where('city_id', '=', $input['city']);
     }
     $data['events'] = $events->orderBy('ended_at', 'desc')->paginate($limit);
     // set input
     $data['input'] = $input;
     return View::make('bagikasih.event.index', $data);
 }
开发者ID:marthem,项目名称:bagikasih,代码行数:34,代码来源:EventController.php

示例3: index

 public function index()
 {
     $blogs = Blog::with('author')->orderBy('created_at', 'desc')->take(10)->get();
     $events = Events::with('author')->orderBy('created_at', 'desc')->take(8)->get();
     $groups = Group::with('author')->orderBy('created_at', 'desc')->take(8)->get();
     $photos = Photo::with('author')->orderBy('created_at', 'desc')->take(8)->get();
     return View::make('home.index')->with('blogs', $blogs)->with('events', $events)->with('groups', $groups)->with('photos', $photos);
 }
开发者ID:shinichi81,项目名称:laravel4demo,代码行数:8,代码来源:HomeController.php

示例4: index

 public function index()
 {
     // init
     $data = array('menu' => $this->_menu, 'title' => 'Dashboard', 'description' => '', 'breadcrumb' => array('Dashboard' => '/'));
     // New payment that need confirmation
     $data['payments'] = Payment::with(array('user', 'donations'))->where('status', '=', 0)->get();
     // New social target that need confirmation
     $data['social_targets'] = SocialTarget::with(array('city', 'category', 'user'))->where('status', '=', 0)->get();
     // New action action that need confirmation
     $data['social_actions'] = SocialAction::with(array('city', 'category', 'user'))->where('status', '=', 0)->get();
     // New event that need confirmation
     $data['events'] = Events::with(array('city', 'category', 'user'))->where('status', '=', 0)->get();
     // New report that need confirmation
     $reports = Report::with(array('user'))->where('have_responded', '=', 0)->get();
     foreach ($reports as $report) {
         $report->setAppends(array('type'));
     }
     $data['reports'] = $reports;
     // return $data;
     return View::make('admin.pages.dashboard')->with($data);
 }
开发者ID:whiterun,项目名称:bagikasih-v2,代码行数:21,代码来源:AdminDashboardController.php

示例5: index

 public function index()
 {
     $events = Events::with('author')->orderBy('created_at', 'desc')->paginate(20);
     return View::make('events.index')->with('events', $events);
 }
开发者ID:shinichi81,项目名称:laravel4demo,代码行数:5,代码来源:EventsController.php


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