本文整理汇总了PHP中Reservation::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Reservation::findOrFail方法的具体用法?PHP Reservation::findOrFail怎么用?PHP Reservation::findOrFail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reservation
的用法示例。
在下文中一共展示了Reservation::findOrFail方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reservation
public function reservation($id)
{
$reservation = Reservation::findOrFail($id);
if ($this->user->id == $reservation->user_id) {
$transaction = Transaction::where('reservation_id', $reservation->id)->first();
$pdf = storage_path() . '/reservations/reservation-' . $transaction->reference_number . '.pdf';
if (file_exists($pdf)) {
return Response::download($pdf);
} else {
return Redirect::to('clients')->with('error', 'PDF was not found.');
}
} else {
return App::abort(404);
}
}
示例2: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
$reservation = $this->reservation->findOrFail($id);
$property = Property::findOrFail($reservation->property_id);
return View::make('admin.reservations.show', compact('reservation', 'property'));
}
示例3: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$reservation = Reservation::findOrFail($id);
$reservation->delete();
return Redirect::back()->with('success', 'Reservatie successvol geannuleerd');
}