I am using laravel 5 and have change the name of a table from "domain_related_settings" to "DomainRelatedSettings".
I did this by rolling back all migrations, change the specific migration and run them again. In phpmyadmin i see my new tablename.
When i use the corresponding model (DomainRelatedSetting.php) with as a class "DomainRelatedSetting"
$domainSettings = App\DomainRelatedSetting::where('hostname', 'localhost')->first();
it gives the following error:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'databasename.domain_related_settings' doesn't exist (SQL: select * from `domain_related_settings` where `hostname` = localhost limit 1)
It seems to look to domain_related_settings. That was my old tablename, which i changed to DomainRelatedSetting.
When i define the new table in the class it works.
protected $table = 'DomainRelatedSettings';
I use the following function in middleware which is causing the error: $domainSettings = App\DomainRelatedSetting::where('hostname', 'localhost')->first();
Is there a location except from the migration and the model where i should update this?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire