PHP code example of cocosmos / filament-quick-add-select

1. Go to this page and download the library: Download cocosmos/filament-quick-add-select 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/ */

    

cocosmos / filament-quick-add-select example snippets


use Filament\Forms\Components\Select;

Select::make('profession_id')
    ->relationship('profession', 'name')
    ->searchable()
    ->quickAdd()

Select::make('skills')
    ->multiple()
    ->relationship('skills', 'name')
    ->searchable()
    ->quickAdd()

Select::make('category_id')
    ->relationship('category', 'name')
    ->searchable()
    ->quickAdd(label: fn(string $search) => "Create new: {$search}")

->quickAdd(label: "New category: {search}")

->quickAdd(resetSearch: true)

->quickAdd(enabled: auth()->user()->can('create', Category::class))



return [
    'add' => '+ Your translation ":term"',
];
bash
php artisan vendor:publish --tag=quick-add-translations