本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例5: index
public function index()
{
$events = Events::with('author')->orderBy('created_at', 'desc')->paginate(20);
return View::make('events.index')->with('events', $events);
}