本文整理汇总了PHP中Entry::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Entry::findOrFail方法的具体用法?PHP Entry::findOrFail怎么用?PHP Entry::findOrFail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entry
的用法示例。
在下文中一共展示了Entry::findOrFail方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postEntryduzenle
public function postEntryduzenle($id)
{
$validate = Validator::make(Input::all(), Entry::$rules);
$messages = $validate->messages();
if ($validate->fails()) {
return Redirect::back()->with(array('mesaj' => 'true', 'title' => 'Doğrulama Hatası', 'text' => '' . $messages->first() . '', 'type' => 'error'));
}
$entry = Entry::findOrFail($id);
$entry->content = Input::get('content');
$entry->save();
if ($entry->save()) {
return Redirect::back()->with(array('mesaj' => 'true', 'title' => 'Entry Güncellendi', 'text' => 'Entry Başarı İle Güncellendi', 'type' => 'success'));
} else {
return Redirect::back()->with(array('mesaj' => 'true', 'title' => 'Entry Güncellenemedi', 'text' => 'Entry Güncellenirken Sorun İle Karşılaşıldı', 'type' => 'error'));
}
}
示例2: edit
/**
* Show the form for editing the specified resource.
* GET /entries/{id}/edit
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$entry = Entry::findOrFail($id);
return View::make('entries.edit', compact(['entry']));
}
示例3: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($logbook_id, $entry_id)
{
$entry = Entry::findOrFail($entry_id);
$entry->delete();
return Redirect::to(route('logbooks.show', [$logbook_id]))->with('message', ['content' => 'Entry met succes verwijderd!', 'class' => 'success']);
}