51 lines
1.7 KiB
PHP
51 lines
1.7 KiB
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Filament\Resources\Projects\Schemas;
|
||
|
|
|
||
|
|
use Filament\Forms\Components\FileUpload;
|
||
|
|
use Filament\Forms\Components\RichEditor;
|
||
|
|
use Filament\Forms\Components\TagsInput;
|
||
|
|
use Filament\Forms\Components\TextInput;
|
||
|
|
use Filament\Forms\Components\Toggle;
|
||
|
|
use Filament\Schemas\Schema;
|
||
|
|
|
||
|
|
class ProjectForm
|
||
|
|
{
|
||
|
|
public static function configure(Schema $schema): Schema
|
||
|
|
{
|
||
|
|
return $schema
|
||
|
|
->components([
|
||
|
|
TextInput::make('title')
|
||
|
|
->required()
|
||
|
|
->live(onBlur: true)
|
||
|
|
->afterStateUpdated(fn ($state, callable $set) => $set('slug', \Illuminate\Support\Str::slug($state))),
|
||
|
|
TextInput::make('slug')
|
||
|
|
->required()
|
||
|
|
->unique(ignoreRecord: true),
|
||
|
|
TextInput::make('summary')
|
||
|
|
->columnSpanFull(),
|
||
|
|
RichEditor::make('description')
|
||
|
|
->columnSpanFull(),
|
||
|
|
FileUpload::make('image')
|
||
|
|
->image()
|
||
|
|
->disk('public')
|
||
|
|
->directory('projects'),
|
||
|
|
TextInput::make('url')
|
||
|
|
->label('Live URL')
|
||
|
|
->url(),
|
||
|
|
TextInput::make('repository_url')
|
||
|
|
->label('Repository URL')
|
||
|
|
->url(),
|
||
|
|
TagsInput::make('tech_stack')
|
||
|
|
->label('Tech stack')
|
||
|
|
->columnSpanFull(),
|
||
|
|
Toggle::make('is_featured')
|
||
|
|
->default(false),
|
||
|
|
TextInput::make('sort_order')
|
||
|
|
->required()
|
||
|
|
->numeric()
|
||
|
|
->default(0),
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
}
|