Skip to content

Best practices ​

Introduction ​

Here we can place common features we use with Qore.works Business but that isn't documented in Filament or elsewhere.

Custom routes ​

Sometimes you need to have custom routes. For example, you have a resource record what needs to generate a PDF. Here is a code sample that will add a route with the protection of Filament.

File: app/Application/Admin/Providers/QorePanelServiceProvider.php

php
use Illuminate\Support\Facades\Route;

public function panel(QorePanel|Panel $panel): QorePanel
{
    return parent::panel($panel)
        ...
        ->routes(function () use ($panel) {
            Route::middleware($panel->getAuthMiddleware())
                ->get('commodity-batches/{record}/print', DownloadCommodityBatchController::class)
                ->name('commodity-batches.print');
        })
        ...
}