0

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

Code cracker
  • 316
  • 1
  • 5
  • 20
  • Probably the issue is related to your User model class, and it's because you are calling a "plans" class inside your User.php file without a correct "use" statement or incorrect namespace inside plans file, can you show us your User.php file? – Guillermo Lobos Oct 21 '21 at 13:37
  • what version of Laravel? ... majority of classes in your project are namespaced not in the root – lagbox Oct 21 '21 at 16:10

1 Answers1

2

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.

Dimitri Mostrey
  • 2,302
  • 1
  • 12
  • 11