vendredi 4 décembre 2015

Laravel 5 function "latest()" doesn't work, when emails are inserted to database

I am adding emails through the query in my database:

DB::table('email')->insert(['from'=>$from,'body'=>$message,'message_no'=>$message_number]);

then i have to display emails which are saved in database. So, for displaying new email on top in display method i have used:

$data = Email::latest()->get();
return view('emails.display',compact('data'));

But, the new emails are at bottom. Then i checked in my table in database there is 00.00.00 in 'created_at' table.

My question is what can i do to fill the 'created_at' filed in database.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire