I have a Mysql database minho.win
and a table called utilizadores
.
I created a model class php artisan make:model Utilizador
When I do php artisan tinker
and then do App\Utilizador::all()
I get this error:
Illuminate\Database\QueryException with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'minho.win.utilizadors' doesn't exist (SQL: select * from
utilizadors
)'
Why is it looking for a table named utilizadors
? How can I make it look for the right table – utilizadores
?
Best Answer
You can specify the table in your model:
https://laravel.com/docs/5.5/eloquent#eloquent-model-conventions