Пример #1
0
 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;
 }
Пример #2
0
 public function projects()
 {
     $projects = Project::all();
     $tags = Tag::orderBy('name', 'asc')->get();
     $years = Project::getArrayDates();
     //Get projects tag
     foreach ($projects as &$project) {
         $link_tags = Project::findOrFail($project->id)->project_tag;
         $project_self_tags = array();
         foreach ($link_tags as $link_tag) {
             array_push($project_self_tags, Tag::findOrFail($link_tag->tag_id));
         }
         $project->tags = $project_self_tags;
     }
     //$project = $project->first();
     //$project->date = Carbon::createFromFormat('Y-m-d H:i:s',$project->date)->format('Y');
     return view('pages.projects', compact('projects', 'tags', 'years'));
 }
 public function listAll()
 {
     $projects = Project::all();
     return view('admin.project.list', compact('projects'));
 }