I have create a laravel object as per the documentation. Though when i am trying to get the value from it, it is throwing the error.
Here is a sample code
$user = USER::findOrFail(2990);
print_r($user);
This is throwing error. Please help me what i am doing wrong?
2
Answers
Its quite hard to answer this without an exact error messsage.
This could be a case sensitivity issue. In Laravel, class names should be written in title case, but it seems you are using uppercase for "USER" instead of "User."
It is also possible that it’s just that no user with ID 2990 exists. And that throws an error. could you recheck if such a user exists?
Please upvode and accept if it helps 🙂
first of all check in your database ( User Table ) what is the value of id = 2990
to print your variable try to use dd($user)