middleware('auth'); } /** * Show the application dashboard. * * @return \Illuminate\Contracts\Support\Renderable */ public function index() { setlocale(LC_TIME, 'fr_FR.utf8'); $today = new \DateTime(); $posts = \App\Post::where('user_id', Auth::user()->getAuthIdentifier())->get(); return view('home', [ 'today' => $today, 'posts' => $posts, ]); } public function store() { $data = request()->validate([ 'message' => 'required' ]); $data = [ 'user_id' => Auth::user()->getAuthIdentifier(), 'date_post' => new \DateTime(), // Take back the date from the form ? 'content' => $data['message'], ]; $check = \App\Post::create($data); return Redirect::to('home')->withSuccess('Great! Form successfully submit with validation.'); } }