PHP code example of hoceineel / filament-quick-action-dock
1. Go to this page and download the library: Download hoceineel/filament-quick-action-dock 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/ */
hoceineel / filament-quick-action-dock example snippets
use App\Filament\Resources\Customers\CustomerResource;
use App\Models\Customer;
use Filament\Actions\Action;
use Filament\Forms\Components\TextInput;
use Filament\Panel;
use Filament\Support\Icons\Heroicon;
use HoceineEl\QuickActionDock\QuickActionDockPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugin(
QuickActionDockPlugin::make()
->actions([
Action::make('newCustomer')
->label('New customer')
->icon(Heroicon::UserPlus)
->keyBindings(['mod+shift+c'])
->schema([
TextInput::make('name')->
use Filament\Facades\Filament;
use HoceineEl\QuickActionDock\Livewire\QuickActionDock;
use HoceineEl\QuickActionDock\Support\DockContext;
use Livewire\Livewire;
beforeEach(function () {
Filament::setCurrentPanel('admin');
$this->actingAs(User::factory()->create());
});
it('creates a customer from the dock', function () {
Livewire::test(QuickActionDock::class)
->callAction('newCustomer', data: ['name' => 'Ada'])
->assertHasNoErrors();
expect(Customer::where('name', 'Ada')->exists())->toBeTrue();
});
it('shows record actions on the edit page', function () {
$customer = Customer::factory()->create();
DockContext::current()->set('filament.admin.resources.customers.edit', ['record' => (string) $customer->getKey()]);
Livewire::test(QuickActionDock::class)->assertSee('Email customer');
});