FilamentF
Filament2y ago
Jap

Select multiple inside Repeater saved in one model.

Repeater::make('employeeDesignations')
    ->schema([
        Select::make('department_id')
            ->multiple()
            ->options(
            User::all()->pluck('name', 'id')
            )
            ->required(),
        Select::make('term_id')
            ->options(
            Term::all()->pluck('name', 'id')
            )
            ->required(),
    ])
    ->columns(2)


Model:
class Employee extends Model
{
  public function employeeDesignations()
    {
        return $this->hasMany(EmployeeDesignation::class);
    }
}
class EmployeeDesignation extends Model
{

    protected $fillable = [
        'employee_id',
        'department_id',
        'term_id',
    ];
}


Anyone can help me implement this? Thanks. Im getting error department_id should be string instead of array. I'm trying to lessen the rows created in the repeater by just using select multiple if it will just have the same term_id.
Was this page helpful?