After having to rename database tables and running migrations I got:
SQLSTATE[42S02]: Base table or view not found
For this piece of code:
Shop::updateOrCreate(
['id' => $id],
['title' => $shopeTitle]
);
Mall::where('id', $id)->update([
'price' => $price,
'visitors' => $visitors
]);
if ($mall != 41 || $mall!= 42) {
DB::table('calc_stores_in_malls')->insert([
'mall' => $price,
'store' => $id
]);
}
Then I have tried with hardcoding new table names like so:
DB::table('calc_shop')->updateOrCreate(
['id' => $id],
['title' => $shopeTitle]
);
DB::table('calc_stores_in_malls')->where('id', $id)->update([
'price' => $price,
'visitors' => $visitors
]);
if ($mall != 41 || $mall!= 42) {
DB::table('calc_stores_in_malls')->insert([
'mall' => $price,
'store' => $id
]);
}
But then I got the new error:
Call to undefined method Illuminate\Database\Query\Builder::updateOrCreate()
How can I fix that?