I am getting error after composer update
QueryException in Connection.php line 636: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'war_id' in 'where clause'
I have 3 tables in many to many relationship
- wars table
id - int pk
- locations table
id - int pk
- war_locations table
id - int pk
war_id int
location_id int
war_locations table is pivot table.
I have declared relation ship in model
War.php
public function locations()
{
return $this->belongsToMany('App\Models\Location', 'war_locations', 'war_id', 'location_id');
}
But when i try to get location of a war then it fails.
$wars = War::with('locations')->where('status',1)->get();
It was working before composer update
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire