本文整理汇总了PHP中Game::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Game::findOrFail方法的具体用法?PHP Game::findOrFail怎么用?PHP Game::findOrFail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game
的用法示例。
在下文中一共展示了Game::findOrFail方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleDelete
public function handleDelete()
{
// hand the delete confirmation
$id = Input::get('id');
$game = Game::findOrFail($id);
$game->delete();
return Redirect::action('GamesController@index');
}
示例2: update
/**
* Update the specified game in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$game = Game::findOrFail($id);
$validator = Validator::make($data = Input::all(), Game::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$game->update($data);
return Redirect::route('games.index');
}
示例3: handleDelete
public function handleDelete()
{
if (Auth::guest()) {
return Redirect::action('UserController@login');
}
// Handle the delete confirmation.
$id = Input::get('game');
$game = Game::findOrFail($id);
$game->delete();
return Redirect::action('GamesController@index');
}
示例4: deleteScript
public function deleteScript($id, $scriptId)
{
/** @var Game $game */
$game = Game::findOrFail($id);
$game->scripts()->detach($scriptId);
// return Redirect::action('GameController@getScript', $id);
}