本文整理汇总了PHP中app\Role::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Role::delete方法的具体用法?PHP Role::delete怎么用?PHP Role::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Role
的用法示例。
在下文中一共展示了Role::delete方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Delete role
*
* @param Role $role
* @return \Illiminate\Http\RedirectResponse
*/
public function delete(Role $role)
{
if ($role->id !== 1) {
$role->delete();
}
return redirect('admin/roles/list');
}
示例2: destroy
public function destroy($id)
{
$user = Role::delete($id);
$user->delete();
foreach ($user->roles() as $u) {
$user->roles()->detach($u->id);
}
}
示例3: destroy
public function destroy(Role $role)
{
if (!Helper::getMode()) {
return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
}
if ($role->name == 'admin') {
return redirect('/configuration#permission')->withErrors(config('constants.INVALID_LINK'));
}
$role->delete();
return redirect()->back()->withSuccess(config('constants.DELETED'));
}
示例4: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy(Role $role)
{
// Set role to null for each user
foreach ($role->users as $user) {
$user->role_id = null;
$user->save();
}
//destroy the role
$role->delete();
return redirect()->route('admin.roles.index')->withWarning("The Role {$role->role} has been removed!");
}
示例5: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy(Role $role)
{
$role->delete();
return redirect('/admin/role')->with('flash_success', 'Роль успешно удалена.');
}
示例6: destroy
/**
* Delete a role
*/
public function destroy(Role $role)
{
logThis('Role ' . $role->label . ' deleted');
$role->delete();
}
示例7: delete_user_role
private function delete_user_role(User $user, Role $role)
{
//Remove all permissions then delete the user and the roles
$role->perms()->sync(array());
$user->delete();
$role->delete();
}
示例8: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy(Role $role)
{
$role->delete();
return redirect()->action('RolesController@index');
}
示例9: apiRoleDelete
/**
* API for deleting a role
*/
public function apiRoleDelete(Role $role)
{
$role->delete();
}
示例10: destroy
/**
* Remove the specified resource from storage.
*
* @param App\Role $role
* @return Response
*/
public function destroy($role)
{
$role->delete();
return redirect()->route('webpanel.store.roles.index');
}