Skip to content

Tag: laravel

user_id is not taking the value provided

The migrations file look like below but the posts table in the database is having 0 as value. 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. Answer It’s very Simple just Go to your Post model when you use create method to insert…

How can i handle the page crash in laravel?

Whenever i leave my website for like 1 hour and whenever i try to access the different part of the website i get “Trying to get property ‘id of non object”, it means that the user have been logged out but the page crashed. So i need a way so that i can apply a middleware to handle this issue…