I’m new to Filament and I’m having a problem to display a record in filament
this is my table
stations Table
id
station_name
unit_assignment Table
id
station_id
personnel_id
personnel table
id
name
in my UnitAssignment Model
public function station()
{
return $this->hasOne(Stations::class, 'station_id', 'id');
}
public function personnel()
{
return $this->belongsTo(Personnel::class, 'personnel_id', 'id');
}
in my Personnel Model
public function unitassignment()
{
return $this->hasOne(UnitAssignment::class, 'personnel_id', 'id');
}
in my Station Model
public function unitassignment()
{
return $this->hasOne(UnitAssignment::class, 'station_id', 'id');
}
now, I can’t find a solution how to call the station_name field in my PersonnelResource page
TextColumn::make('unitassignment.station_id')->label('Unit Assignment')
This one work but only displays the station_id, i want to display the station_name.
TextColumn::make('unitassignment.station.station_name')->label('Unit Assignment')