call to member function on null in select with relationship
What should be the error here, my code
I also put
public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Tabs::make('Label')
->tabs([
Forms\Components\Tabs\Tab::make('Personal details')
->schema([
Forms\Components\Grid::make()
->schema([
Forms\Components\Select::make('languages.name')
->label('Languages')
->required()
->multiple()
->relationship(name: 'languages', titleAttribute: 'name')
->searchable()
->preload(),
]),
]),
]),
]);
}
// relationship
public function languages(): BelongsToMany
{
return $this->belongsToMany(Language::class);
}
// blade.php
{{ $this->form }}public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Tabs::make('Label')
->tabs([
Forms\Components\Tabs\Tab::make('Personal details')
->schema([
Forms\Components\Grid::make()
->schema([
Forms\Components\Select::make('languages.name')
->label('Languages')
->required()
->multiple()
->relationship(name: 'languages', titleAttribute: 'name')
->searchable()
->preload(),
]),
]),
]),
]);
}
// relationship
public function languages(): BelongsToMany
{
return $this->belongsToMany(Language::class);
}
// blade.php
{{ $this->form }}I also put
$this->form->fill();$this->form->fill(); in mount()