Grundgerüst Formulare und Seeder
This commit is contained in:
34
app/Filament/Resources/Contracts/Schemas/ContractForm.php
Normal file
34
app/Filament/Resources/Contracts/Schemas/ContractForm.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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'),
|
||||
])
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user