public function projects() { $data['projects'] = Project::all(); $data['page'] = Page::find(3); $data['meta_title'] = ''; $data['meta_desc'] = ''; return view('projects', $data); }
public function destroy($id) { if (Auth::user()->can_delete(4)) { if ($page = Page::find($id)) { $dir = public_path('images/project/' . $project->id); if (File::isDirectory($dir)) { File::deleteDirectory($dir); } $page->delete(); return redirect()->route('admin.project.index')->with(['type' => 'danger', 'message' => '<span class="fa fa-times"></span> Le projet a bien été supprimé.']); } else { return redirect()->route('admin.project.index')->with(['type' => 'danger', 'message' => '<span class="fa fa-times"></span> Le projet sélectionné n\'existe pas.']); } } else { return redirect()->route('admin.dashboard.index')->with(['type' => 'danger', 'message' => '<span class="fa fa-ban"></span> Vous n\'avez pas les droits nécessaires pour accéder à cette partie.']); } }