本文整理汇总了PHP中Events::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Events::findOrFail方法的具体用法?PHP Events::findOrFail怎么用?PHP Events::findOrFail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Events
的用法示例。
在下文中一共展示了Events::findOrFail方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
public function show($id)
{
$events = Events::findOrFail($id);
$data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all();
$data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all();
$data['about'] = About::get()->all();
return View::make('Events.show', compact('events'))->with('event_active', 'active')->with('data', $data);
}
示例2: update
/**
* Update the specified event in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$event = Events::findOrFail($id);
$validator = Validator::make($data = Input::all(), Events::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$event->update($data);
return Redirect::route('events.index');
}
示例3: getEditEvent
/**
* View for Edit Event
* @return View
*/
public function getEditEvent($id)
{
try {
$event = \Events::findOrFail($id);
} catch (ModelNotFoundException $e) {
throw new \EventNotFoundException();
}
$emaillist = null;
//Get the user id of the currently logged in user
$userId = \Sentry::getUser()->id;
//Check Permission
$checkpermission = $this->event->checkPermission($id, $userId);
if ($checkpermission) {
//Authorized, Get Event
$event = $this->event->getEvent($id);
foreach ($event['users'] as $user) {
if ($emaillist == null) {
$emaillist = $user['email'];
} else {
$emaillist = $emaillist . ',' . $user['email'];
}
}
//Wrap Up and generate View
return \View::make('dashboard.calendar.edit')->with('emaillist', $emaillist)->with('event', $event);
} else {
throw new \NotAuthorizedForEventException();
}
}
示例4: getDeleteEvent
public function getDeleteEvent($id)
{
$del = Events::findOrFail($id);
$check = File::delete('uploads/events/' . $del->img);
$name = $del->name;
$del->delete();
Session::flash('message', "ลบ " . $name . " สำเร็จ!!");
return Redirect::to('/admin/events/manage');
}