本文整理汇总了PHP中app\Event::first方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::first方法的具体用法?PHP Event::first怎么用?PHP Event::first使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Event
的用法示例。
在下文中一共展示了Event::first方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Our index page listing all stations
*
* @author David Varney
*/
public function index(Request $request)
{
$default_event = Event::first();
$event_id = $request->input('event_id', $default_event->id);
$event = Event::find($event_id);
$stations = $event->stations()->get();
return view('admin.station_data.index', array('title' => 'Admin: Station Data', 'stations' => $stations, 'event_id' => $event_id, 'events' => Event::lists('name', 'id')));
}
示例2: tearDown
protected function tearDown()
{
if (is_null($this->lastEvent)) {
$event = Event::first();
if (!is_null($event)) {
$event->delete();
}
} else {
Event::where('eid', '>', $this->lastEvent)->delete();
}
User::where('uid', $this->user->uid)->delete();
}
示例3: index
/**
* Show the application dashboard.
*
* @return Response
*/
public function index()
{
try {
$isInstalled = Setting::where('name', 'is_installed')->firstOrFail();
} catch (ModelNotFoundException $e) {
$isInstalled = Setting::create(['name' => 'is_installed', 'setting' => 'no']);
}
if ($isInstalled->setting != 'yes') {
return Redirect::route('install');
}
$data = ["event" => Event::first(), "upcomingEvents" => Event::take(3)->get(), "news" => News::take(6)->get(), "media" => Media::where('processed', true)->orderBy('id', 'DESC')->take(12)->get()];
return view('home')->with($data);
}
示例4: calendar
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function calendar()
{
$events = [];
$getevents = Event::all();
foreach ($getevents as $event) {
$events[] = \Calendar::event($event->titl, false, new \DateTime($event->start), new \DateTime($event->end), $event->event_id);
}
$events[] = \Calendar::event('Event One', false, '2015-11-11T0800', '2015-11-12T0800', 0);
$events[] = \Calendar::event("Valentine's Day", true, new \DateTime('2015-11-14'), new \DateTime('2015-11-14'), 'stringEventId');
$eloquentEvent = Event::first();
//Event implements MaddHatter\LaravelFullcalendar\Event
$calendar = \Calendar::addEvents($events);
return view('calendar', compact('calendar'));
}
示例5: home
/**
* Adds an opportunity to pass any data from models
*
* @author David Varney
*/
public function home()
{
return view('layouts.frontend_app', array('states' => FormHelper::get_states(), 'graduation_years' => FormHelper::get_graduation_years(), 'genders' => FormHelper::get_genders(), 'shirt_sizes' => FormHelper::get_shirt_sizes(), 'event_id' => Event::first()->id));
}