本文整理匯總了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;
}