本文整理汇总了PHP中app\Event::with方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::with方法的具体用法?PHP Event::with怎么用?PHP Event::with使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Event
的用法示例。
在下文中一共展示了Event::with方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of all events
*
*/
public function index()
{
// $events = Event::with('user')->orderBy('date_start', 'desc')->get();
$eventsFeatured = Event::with('user')->where('feature_event', 1)->get();
$events = $this->facebookSdk->getCurrentEvents();
$events = json_decode(json_encode($events));
return view('pages.events.index', compact('events', 'eventsFeatured'));
}
示例2: show
public function show($localId)
{
$event = \App\Event::with('users')->where('local_id', $localId)->first();
if (!$event) {
return response()->json(['message' => 'Damn! You just missed it.'], 404);
}
return $event;
}
示例3: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($slug)
{
$categories = Category::lists('name', 'id');
$events = Event::with('category')->where('slug', $slug)->first();
$category = $events->category;
$similarEvent = Event::where('category_id', $category->id)->where('event_date', ">", \Carbon\Carbon::now())->orderBy('created_at', 'desc')->limit(3)->get();
return view('events.event', compact('events', 'categories', 'similarEvent'));
}
示例4: isNotSoldOut
/**
* La fonction isSoldOut($eventId) permet de vérifier si un événement est n'est pas complet.
* @param int $eventId - l'id de l'événement
* @return boolean true si l'événement n'est pas complet, false sinon
*/
public static function isNotSoldOut($eventId)
{
$event = Event::with('guests')->find($eventId);
$guests = count($event->guests);
if ($event->capacity == 0) {
return FALSE;
}
return $event->capacity > $guests;
}
示例5: getSingleEvent
public function getSingleEvent(Event $event)
{
$events = Event::with('posts')->where('id', '=', $event->id)->paginate(10);
SEO::setTitle("{$event->title} - Melbourne Cocoaheads");
SEO::setDescription($event->subtitle);
SEO::opengraph()->setUrl($event->url());
SEO::opengraph()->setArticle(['published_time' => $event->created_at, 'modified_time' => $event->modified_at, 'expiration_time' => $event->ends_at, 'author' => 'Jesse Collis', 'section' => 'updates', 'tag' => ['updates']]);
return view('events', ['events' => $events, 'title' => $event->title]);
}
示例6: getEvents
public function getEvents(Request $request)
{
if (\Request::ajax()) {
if (!empty($request->get('search'))) {
$events = Event::search($request->get('search'))->with('user')->paginate(15);
} else {
$events = Event::with('user')->paginate(15);
}
return \Response::json($events);
}
return \Response::json(['status' => 'error'], 400);
}
示例7: getEventByConferenceID
/**
* Display a listing of events given the conferenceID.
* @return Response
*/
public function getEventByConferenceID(Request $req, $conferenceID)
{
$conf = Conference::find($conferenceID);
if (is_null($conf)) {
return response("No conference for id {$conferenceID}.", 405);
}
//Select events, populate with "attendees" so we can calculate the
//remaining capacity
$event = Event::with("attendees")->where('conferenceID', $conferenceID)->get();
$evtArray = $event->toArray();
if (sizeof($evtArray) == 0) {
return response("No events for conferenceID {$conferenceID}.", 404);
}
$evtArray = array_map(function ($e) use($req) {
return $this->show($req, $e);
}, $evtArray);
return $evtArray;
}
示例8: search
public function search()
{
$events = new Event();
$events = $events->with('category')->where('publish', 1);
$title = Input::get('name', null);
if ($title) {
$events->where('title', 'LIKE', "%{$title}%");
}
if (Input::get('category_id')) {
$events->where('category_id', Input::get('category_id'));
}
if (Input::get('date')) {
$events->where('event_date', Input::get('date'));
}
$categories = Category::lists('name', 'id');
$highlighted = Event::with('category')->where('highlight', 1)->where('publish', 1)->where('event_date', ">", \Carbon\Carbon::now())->orderBy('event_date', 'asc')->limit(6)->get();
$events = $events->orderBy('event_date', 'asc')->where('event_date', ">", \Carbon\Carbon::now())->paginate(5);
return View::make('index', compact('events', 'highlighted', 'categories'));
}
示例9: events
public function events()
{
$events = Event::with('user')->paginate(15);
return view('ticketsadmin::events', compact('events'));
}
示例10: getPublishedEvent
public function getPublishedEvent()
{
$event = Event::with('get_category')->where('is_published', '=', 1)->get();
return view('events', array('events' => $event));
}
示例11: index
/**
* @return mixed
*/
public function index()
{
return view('events.index')->withEvents($this->event->with('photo')->orderBy('date', 'DESC')->paginate(10));
}
示例12: function
<?php
namespace App\ViewComposers;
use View;
use Auth;
use App\Event;
View::composer('partials.upcoming-events', function ($view) {
// Upcoming Events (by League)
$leagues = [(object) ['name' => 'Poker'], (object) ['name' => 'Trivia']];
foreach ($leagues as $league) {
$league->events = Event::with('league')->with(['league.venue' => function ($query) {
$query->orderBy('id');
}])->whereHas('league', function ($query) use($league) {
$query->where('activity', $league->name);
})->whereRaw('date(datetime) between ? and ?', [date('Y-m-d'), date('Y-m-d', time() + 60 * 60 * 24 * 7)])->whereHas('league.venue', function ($query) {
$query->whereRaw('private is not true')->orWhereRaw('id in (select venue_id from t_venue_players where player_id=?)', [Auth::user()->id]);
})->orderByRaw('date(datetime)')->orderByRaw('(select venue_id from t_leagues where id=league_id)')->orderByRaw('time(datetime)')->get();
}
// Registered Events
$registered = Auth::user()->registeredEvents ?: [];
$registered = array_map(function ($event) {
return $event->id;
}, $registered);
// Bind Data
$view->with('leagues', $leagues);
$view->with('registered', $registered);
});
示例13: indexSearch
public function indexSearch(Request $request)
{
$events = Event::with('user', 'category')->searchFor($request->get('search'))->get()->toArray();
return $this->respond($events);
}
示例14: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$event = Event::with('bands', 'manager', 'article')->find($id);
if (empty($event)) {
Flash::error('Cet événement n\'existe pas.');
abort(404);
}
return view('events.edit', compact('event'));
}
示例15: getEvents
public function getEvents($name)
{
$user = User::where('name', $name)->first();
$user_id = $user->id;
$oldEvents = Event::with('category')->where('user_id', $user_id)->where('event_date', "<", \Carbon\Carbon::now())->orderBy('created_at', 'desc')->get();
$events = Event::with('category')->where('user_id', $user_id)->where('event_date', ">", \Carbon\Carbon::now())->orderBy('created_at', 'desc')->get();
return view('admin.events', compact('events', 'user', 'oldEvents'));
}