本文整理汇总了PHP中app\models\Role::destroy方法的典型用法代码示例。如果您正苦于以下问题:PHP Role::destroy方法的具体用法?PHP Role::destroy怎么用?PHP Role::destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Role
的用法示例。
在下文中一共展示了Role::destroy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
*
* @return mixed
*/
public function destroy($id)
{
$canBeDeleted = empty(Role::find($id)->available_appointment->toArray());
if ($canBeDeleted) {
Role::destroy($id);
\Flash::success('Role deleted!');
} else {
\Flash::error('Cannot delete because they are existing appointments for this role.');
}
return redirect('admin/data-management/roles');
}
示例2: getDelete
public function getDelete($id)
{
Role::destroy($id);
return redirect()->back();
}
示例3: destroyRole
/**
* Locate role, detach from perms and users then delete.
*
* @param $name
*/
protected static function destroyRole($name)
{
$roleActiveDirectoryInspector = Role::where('name', $name)->first();
if ($roleActiveDirectoryInspector) {
$roleActiveDirectoryInspector->perms()->detach();
$roleActiveDirectoryInspector->users()->detach();
Role::destroy($roleActiveDirectoryInspector->id);
}
}
示例4: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
if ($result = check_auth_to('JSLB_DELETE')) {
return $result;
}
try {
Role::destroy($id);
return redirect()->action('Admin\\RoleController@index')->with('operationstatus', 'sucess');
} catch (\Exception $e) {
return redirect()->back()->withErrors(['error' => '删除角色失败,请重试(' . $e->getMessage() . ')']);
}
}
示例5: delete
/**
* Elimina un rol especifico
*
* @param int $id
* @return Response
*/
public function delete($id)
{
$data["id"] = $id;
$validator = Validator::make($data, ['id' => 'integer']);
if ($validator->fails()) {
return response()->json(["msg" => "alert", "validator" => $validator->messages()], 200);
}
if ($role = Role::destroy($id)) {
return response()->json(["msg" => "Success"], 200);
} else {
return response()->json(["msg" => "error", "description" => "No se ha encontrado el rol"], 200);
}
}
示例6: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
Role::destroy($id);
$code = 200;
$msg = json_encode(array('msg' => $code));
return $msg;
}
示例7: destroyRole
public function destroyRole($id)
{
$result = Role::destroy($id);
return $result;
}