I'm having this error:
message: "Call to undefined method App\Models\Newsletter::title_color_id()"
And I'm not understanding how to properly solve it.
I have a newsletter table with this structure:
newsletter table:
id, title, background_color_id, description
The Newsletter resource:
class Newsletter extends Resource{
public function fields(Request $request)
{
return [
ID::make(__('ID'), 'id')->sortable(),
Text::make('Title')->sortable(),
BelongsTo::make('Color', 'title_color_id'),
Text::make('Description')->sortable(),
];
}
}
The Newsletter model:
class Newsletter extends Model
{
use HasFactory;
protected $table = 'newsletter';
public function color()
{
return $this->belongsTo(Color::class);
}
}
Do you know what can be the issue?