DEV Community

Horacio Degiorgi
Horacio Degiorgi

Posted on

3

Tips y apuntes de filament PHP parte 2

Configuración de los formularios

 public static function form(Form $form): Form
    {
        return $form
            ->schema([
// usa la relación con la tabla usuarios definida en el método Blog::author() del modelo
                Forms\Components\Select::make('user_id')
                ->required() ->relationship('author', 'name')
                    ->default(request()->query('ownerRecord'))->label('Usuario'),
                Forms\Components\TextInput::make('title')->label('Título')
                    ->required()
                    ->maxLength(150),
                Forms\Components\Textarea::make('abstract')->label('Resumen')
                    ->required(),
                Forms\Components\RichEditor::make('content')->label('Contenido')
                    ->required(),
                Forms\Components\Toggle::make('active')->label('Visible')
                    ->required(),
                Forms\Components\FileUpload::make('image')->label('Imagen')->image()
                ->imagePreviewHeight('250')
    ->loadingIndicatorPosition('left')
    ->panelAspectRatio('2:1')
    ->panelLayout('integrated')
    ->removeUploadedFileButtonPosition('right')
    ->uploadButtonPosition('left')
    ->uploadProgressIndicatorPosition('left')
                ,
     Forms\Components\TextInput::make('slug')
                    ->maxLength(255),
            ]);
    }
Enter fullscreen mode Exit fullscreen mode

El formulario completo se ve de la siguiente manera.

Image description

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs