redaoutarid
redaoutarid
FFilament
Created by redaoutarid on 7/23/2024 in #❓┊help
Relation manager layout design
No description
13 replies
FFilament
Created by redaoutarid on 7/23/2024 in #❓┊help
Hide "save changes" button in form wizard
No description
14 replies
FFilament
Created by redaoutarid on 7/22/2024 in #❓┊help
Handle nullable relationship in edit form
I have "Project" and "HumanResource" models. Each project has a "project manager" and "operational_manager", both belong to "HumanResource" model. i can create a project without mentionning the project and operational managers. In this case the "project_manager" and "operational_manager" will be null. When i don't set those fields i get the error in attachment. Otherwise, i pass normally. EditRecord Code :
Section::make()->schema([
Forms\Components\Select::make('project_manager')
->relationship(name: 'projectManager', titleAttribute: 'full_name')
->searchable()
->preload()
->nullable(),
Forms\Components\Select::make('operational_manager')
->relationship(name: 'operationalManager', titleAttribute: 'full_name')
->searchable()
->preload()
->nullable()
]);
Section::make()->schema([
Forms\Components\Select::make('project_manager')
->relationship(name: 'projectManager', titleAttribute: 'full_name')
->searchable()
->preload()
->nullable(),
Forms\Components\Select::make('operational_manager')
->relationship(name: 'operationalManager', titleAttribute: 'full_name')
->searchable()
->preload()
->nullable()
]);
relationship code in Project model :
public function projectManager()
{
return $this->hasOne(HumanResource::class, 'project_manager');
}

public function operationalManager()
{
return $this->hasOne(HumanResource::class, 'operational_manager');
}
public function projectManager()
{
return $this->hasOne(HumanResource::class, 'project_manager');
}

public function operationalManager()
{
return $this->hasOne(HumanResource::class, 'operational_manager');
}
6 replies
FFilament
Created by redaoutarid on 7/17/2024 in #❓┊help
Add a Table to a form
No description
9 replies