laraveltinker

How to rectify class not found in psy shell in laravel tinker?


I am very new to the laravel tinker part, I have one model based on that model I am trying to update some column value but it's throwing an error please help me to resolve the issue.

User::update(["status"=>"active"])->where ('id',1);

Error I am getting is

PHP FATAL error: class 'User' not found in psy shell code on line1


Solution

  • Try User::update(["status"=>"active"])->where ('id',1)->first(); or better still:

    $user = User::find(1);
    $user->update(["status"=>"active"]);
    

    Where 'plans' comes from must be a mistake in your User model. Did you add private $with(['plans']); or something similar in the model? Maybe you should post your User.php model in the question.