Filament: Shop Opening Times Form

Dynamic form with multiple checkboxes/dropdowns for the weekdays when the shop is opened. Also, custom table columns to show opening times.

10-shop-opening-times-form

Get the Source Code:

How it works

The main logic lives in our ShopResource method form():

  • We are using a Repeater field to create a dynamic form with multiple rows
  • We are assigning default array of items to the Repeater field
  • We are using live() fields (reactive fields) to enable/disable other fields based on the checkbox value

And for our Index, we are using a custom column Opening Times:

  • We simply create a new column
  • Pass the relationship details
  • Print rows

Working With Form

app/Filament/Resources/ShopResource.php

class ShopResource extends Resource
{
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name')
->required()
->maxLength(255),
// Simple new section to group fields
Forms\Components\Section::make('Opening Times')
->schema([
// Repeater field with relationship to OpeningTime model
Repeater::make('openingTimes')
 
// ...
The FULL tutorial is available after the purchase: in the Readme file of the official repository you would get invited to.
Get the Source Code: All 50 Premium Examples for $99 Only Form Examples for $39