public function project($url) { $project = Project::where('url_page', '=', $url)->get(); $project = $project->first(); $project->date = Carbon::createFromFormat('Y-m-d H:i:s', $project->date)->format('Y'); return view('pages.project', compact('project')); }
static function getArrayDates() { $projects = Project::all(); $array_dates = array(); $array_dates[0] = 'Année'; foreach ($projects as $project) { $dt = Carbon::parse($project->date); if (!in_array($dt->year, $array_dates) && $dt->year > 0) { array_push($array_dates, $dt->year); } } return $array_dates; }
public function delete($id) { $project = Project::findOrFail($id); $project->delete(); return redirect('admin/project'); }