Skip to content

Create Record

The Create Page in Xumina is a specialized page designed to facilitate the creation of new records for a specific resource.

Create Form

The structure of the page are defined in outline method. Create page adds a form component when created via xumina:resource command.

public function outline(): array
{
return [
Form::make('category')
->fields([
])
];
}

Form fields are added inside the fields method. Xumina provides following form field components

Validation

Xumina uses laravel validation to validate form fields. Validation rules are defined via rules method of a field component using regular laravel validation rules syntax.

Input::make('name')
->rules('required|string|max:255'),
Input::make('slug')
->rules(['required', 'string', 'max:255']),

Both string and array format are supported.

Route Definitions

The routes method defines the routes associated with this page:

public static function routes(): array
{
return [
Route::get('categories/create', [CategoryController::class, 'create'])
->name('categories.create'),
Route::post('categories', [CategoryController::class, 'store'])
->name('categories.store'),
];
}

This method typically defines a GET route for displaying the form and a POST route for handling form submission.