I have a table of countries and a table of continents. The countries has a field "continent_id". The Country model has a method:
public function getContinent()
{
return $this->belongsTo('App\Models\Continent','continent_id','id');
}
and if I test this with tinker I get the right response:
$co = App\Models\Country::with('getContinent)->first()
In my setup on CountryCrudController I want to add a field that shows the continent - and I will also want to add a selection of the 7 continents to the countries edit, so in the list part I defined:
$this->crud->addColumn([
'name' => "continent",
'label' => "continent", // Table column heading
'type' => "select",
'entity' => 'getContinent ', // the method in your Model
'attribute' => 'continent',
]);
but when I try to run it I get:
What I am doing wrong please?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire