Exemplo n.º 1
0
 public function destroy(Department $department)
 {
     if (!Helper::getMode()) {
         return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
     }
     $department->delete();
     return redirect('/configuration#department')->withSuccess(config('constants.DELETED'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Department $department)
 {
     if ($department->id < 7) {
         return redirect()->route('admin.department.index')->with('danger', 'You\'d not better do this action!!!');
     }
     $department->delete();
     return redirect()->route('admin.department.index')->with('success', 'successfully deleted');
 }
Exemplo n.º 3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  Department  $department
  * @return \Illuminate\Http\Response
  */
 public function destroy(Department $department)
 {
     try {
         $department->delete();
     } catch (QueryException $e) {
         return redirect()->back()->with('error', 'error-delete-department');
     }
     File::delete('images/' . $department->image);
     File::delete('papers/' . $department->keyword);
     Cache::forget('departments');
     return redirect(action('Admin\\DepartmentController@index'))->with('success', 'deleted');
 }
Exemplo n.º 4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Department $department)
 {
     if (!$department) {
         abort(403, "Department does not exist, permanently deleted");
     }
     if (!Auth::user()->can('administrate-department')) {
         abort(401, "You do not have permission to delete this department");
     }
     $department->delete();
     return $department;
 }
Exemplo n.º 5
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Department $department)
 {
     $department->delete();
     return redirect()->route('admin.department.index')->with('success', 'successfully deleted');
 }