本文整理匯總了PHP中Permission::findOrFail方法的典型用法代碼示例。如果您正苦於以下問題:PHP Permission::findOrFail方法的具體用法?PHP Permission::findOrFail怎麽用?PHP Permission::findOrFail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Permission
的用法示例。
在下文中一共展示了Permission::findOrFail方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: update
/**
* Update the specified permission in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$permission = Permission::findOrFail($id);
$validator = Validator::make($data = Input::all(), Permission::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$permission->update($data);
return Redirect::route('permissions.index');
}
示例2: update
/**
* Update the specified permission in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
try {
$permission = $this->permissions->findOrFail($id);
app('Pingpong\\Admin\\Validation\\Permission\\Update')->validate($data = $this->inputAll());
$permission->update($data);
return $this->redirect('permissions.index');
} catch (ModelNotFoundException $e) {
return $this->redirectNotFound();
}
}
示例3: destroy
/**
* Remove the specified permission from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$permission = Permission::findOrFail($id);
if (!$permission->canDelete()) {
return _access_denied();
}
if (!$permission->delete()) {
return $this->_delete_error();
}
if (Request::ajax()) {
return Response::json($this->deleted_message);
}
return Redirect::route('permissions.index')->with('notification:success', $this->deleted_message);
}
示例4: update
/**
* Update the specified resource in storage.
* PUT /permissions/{id}
*
* @param int $id
* @return Response
*/
public function update($id)
{
$permission = \Permission::findOrFail($id);
$permission->update($data = \Input::all());
return \Redirect::route('admin.permissions.index');
}
示例5: destroyperm
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroyperm($id)
{
$permission = Permission::findOrFail($id);
$permission->delete();
return Redirect::action('PermissionController@index')->with('success', Lang::get('permissions.delete_success'));
}