Skip to content
Advertisement

user_id is not taking the value provided

The migrations file look like below

JavaScript

but the posts table in the database is having 0 as value.this shows the database

The database is populated through the web.php code below. I need the user_id to have values 1 and 2 in the database posts.

JavaScript

Advertisement

Answer

It’s very Simple

just Go to your Post model

when you use create method to insert data you must be use fillable propery in your model.

so if you not have an Post model so create post Model and paste this code inside your Post Model

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement