Answer
You have to use Category::create() instead of Category::insert()
Because create() is use for single row insertion and insert() is used for multi-row insertion
And also you don't have to specify created_at timestamps, laravel model handle it
And here you are inerting single row at a time
Category::create([
'category_name'=>$request->category_name,
'user_id'=>Auth::user()->id
]);
Maybe it will helpful
0 comments:
Post a Comment
Thanks