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),
]);
}
El formulario completo se ve de la siguiente manera.
Top comments (0)