check the class name and case-sensitivity of 'App\SMSLog'
Jul 8, 2019
3
Level 3
Query failing on prod server but not local
Hello, I having some trouble with some relation query on prod server. Database and files are the same.
On my model Communication I have a polymorphic relationship to the SMSLog model.
/**
* Get delivered SMS's associated with the communication.
* One To Many (Polymorphic)
*/
public function delivered_sms(){
return $this->morphMany('App\SMSLog', 'model')->where('status', 'delivered');
}
On the communication controller I have:
public function index(){
$communications = \App\Communication::orderBy('created_at', 'desc')
->paginate(20);
return view('communication/index', compact('communications'));
}
Then on my blade view I'm using {{ $communication->delivered_sms()->count() }} to count how many delivered messages I have. This works on local but on prod It throws the error:
[2019-07-09 03:40:04] production.ERROR: Class 'App\SMSLog' not found (View: /var/www/vhosts/***/laravel/resources/views/communication/index.blade.php) {"userId":1,"email":"***","exception":"[object] (ErrorException(code: 0): Class 'App\SMSLog' not found (View: /var/www/vhosts/***/laravel/resources/views/communication/index.blade.php) at /var/www/vhosts/***/laravel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php:656, Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Class 'App\SMSLog' not found at /var/www/vhosts/***/laravel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php:656)
Level 4
Please or to participate in this conversation.