I am having this code in my controller
foreach($blogTags as $blogTagsData)
{
$data[] = array(
'blog_id' => $postBlog->id,
'user_id' => '1',
'tag_id' => $blogTagsData[0]);
}
BlogTag::insert($data);
Where $blogTags will have 1,2,3 like that.
But when i do the insert
it is not inserting the timestamps in the created_at field and updated_at field..
Even i have this inside my model
public $timestamps = true;
What is the mistake i am doing,,,
Is only doing the following way only option ?
$data['created_at']= \Carbon\Carbon::now()->toDateTimeString();
$data['updated_at']= \Carbon\Carbon::now()->toDateTimeString();
Or is there any better way to include the laravel default timestamp insertion ..
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1WoBUva
via IFTTT
Aucun commentaire:
Enregistrer un commentaire