In my Nova Resource ...
class Person extends Resource
... I have this subtitle() method (which is part of a Nova Resource Class):
public function subtitle()
{
return $this->address->city;
}
Person Model:
class Person extends Model
{
public function addresses()
{
return $this->hasMany('App\Address');
}
}
Address Model:
class Address extends Model
{
public function person()
{
return $this->belongsTo('App\Person');
}
}
$this->address->city returns NULL, why?
Of course the column "city" exits in the addresses table and there are data in the database tables, also related data.