/** * Execute the console command. * * @return mixed */ public function handle() { $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:News] STARTING'); $news = xml_new_actu(); $cptNew = 0; $cptEdit = 0; foreach ($news as $new) { $dbnew = FFTTNew::where('date', $new->date)->where('titre', $new->titre)->first(); if ($dbnew == null) { $dbnew = new FFTTNew(); $cptNew++; } else { $cptEdit++; } $dbnew->date = $new->date; $dbnew->titre = $new->titre; $dbnew->description = $new->description; $dbnew->url = $new->url; $dbnew->photo = $new->photo; $dbnew->save(); } $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:News] ENDING'); $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:News] ' . $cptNew . ' nouvel(eaux) article(s)'); $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:News] ' . $cptEdit . ' article(s) modifié(s)'); $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:News] ENDED'); }
public function Home() { $flash = Event::where('start_date', '<=', new \Datetime())->where('end_date', '>=', new \Datetime())->orderBy('id', 'desc')->take(1)->get()->first(); $articles = Article::where('id', '!=', isset($flash) ? $flash->article->id : 0)->orderBy('publish_at', 'desc')->orderBy('id', 'desc')->take(5)->get(); $ffttNews = FFTTNew::orderBy('date', 'desc')->take(3)->get(); return view('front.home', array('articles' => $articles, 'NewsFlash' => $flash, 'ffttNews' => $ffttNews)); }
public function News() { $news = FFTTNew::all(); return view('admin.batchs.news', array('news' => $news)); }