PHP code example of labapawel / filament-planer

1. Go to this page and download the library: Download labapawel/filament-planer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

labapawel / filament-planer example snippets


use Labapawel\FilamentPlaner\Forms\Components\Planer;

public static function form(Form $form): Form
{
    return $form
        ->schema([
            Planer::make('schedule')
                ->label('Weekly Plan')
                // Optional customizations:
                ->days([1, 2, 3, 4, 5]) // Define visible days (1=Mon to 7=Sun)
                ->hours(['08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00']) // Custom hour slots
                ->fullDayConfig([
                    'enabled' => true,      // Enable "Select All" buttons
                    'default_hours' => 8,   // Max hours to select when using 'first_n' strategy
                    'strategy' => 'first_n', // Strategies: 'all_available' or 'first_n'
                ])
                ->disabled(fn ($record) => $record?->is_locked),
        ]);
}

return [
    'hours' => [
        'start' => '08:00',
        'end' => '16:00',
        'step' => 60, // Interval in minutes
    ],
    'days' => [1, 2, 3, 4, 5], // Default: Monday to Friday
    'full_day' => [
        'enabled' => true,
        'default_hours' => 8,
        'strategy' => 'all_available',
    ],
];
bash
php artisan vendor:publish --tag="filament-planer-config"