本文整理汇总了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'));
}