35 lines
1.0 KiB
PHP
35 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Contracts\Schemas;
|
|
|
|
use App\Models\Contact;
|
|
use App\Models\User;
|
|
use Filament\Forms\Components\MorphToSelect;
|
|
use Filament\Forms\Components\Select;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Schemas\Schema;
|
|
|
|
class ContractForm
|
|
{
|
|
public static function configure(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->components([
|
|
TextInput::make('name')
|
|
->required(),
|
|
TextInput::make('type')
|
|
->required(),
|
|
Select::make('responsible_id')
|
|
->relationship('responsible', 'name')
|
|
->required(),
|
|
MorphToSelect::make('contractable')
|
|
->types([
|
|
MorphToSelect\Type::make(User::class)
|
|
->titleAttribute('name'),
|
|
MorphToSelect\Type::make(Contact::class)
|
|
->titleAttribute('name'),
|
|
])
|
|
]);
|
|
}
|
|
}
|