invoker-community icon indicating copy to clipboard operation
invoker-community copied to clipboard

issue when have scopes

Open shahabzebare opened this issue 3 years ago • 0 comments


OS: darwin Invoker Version: 2.8.0 Laravel Version: 8.44.0 Local project: unknown PHP Binary: /usr/local/bin/php Route: /home

Error:

ErrorException 

  Attempt to read property "doctor" on null

  at doctors.badinansoft.com/app/Models/AllAppointment.php:50
     46▕ 
     47▕     protected static function boot():void
     48▕     {
     49▕         parent::boot();
  ➜  50▕         if(auth()->user()->doctor)
     51▕         {
     52▕             static::addGlobalScope('appointments', function (Builder $builder) {
     53▕                 $builder->where('doctor_id', auth()->user()->doctor->id);
     54▕             });

  1   doctors.badinansoft.com/app/Models/AllAppointment.php:50
      Illuminate\Foundation\Bootstrap\HandleExceptions::handleError()

      [2m+2 vendor frames [22m
  4   phar:///tmp/ploi_invoker.phar/src/Factories/ModelItem.php:20
      Illuminate\Database\Eloquent\Model::__construct()

shahabzebare avatar Feb 20 '22 11:02 shahabzebare