public function page_project($id) { $data['project'] = Project::find($id); $data['meta_title'] = $data['project']->meta_title; $data['meta_desc'] = $data['project']->meta_desc; return view('page_project', $data); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $project_image = Project_image::find($id); // get the project $project = Project::find($project_image->project_id); // delete $project_image->delete(); // redirect \Session::flash('message', 'Successfully deleted the project_image!'); return \Redirect::to("admin/project_images/{$project->id}"); }
public function destroy($id) { if (Auth::user()->can_delete(3)) { if ($project = Project::find($id)) { $dir = public_path('images/project/' . $project->id); if (File::isDirectory($dir)) { File::deleteDirectory($dir); } $project->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.']); } }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // delete $project = Project::find($id); $project->delete(); // redirect \Session::flash('message', 'Successfully deleted the project!'); return \Redirect::to('admin/projects'); }