1. Go to this page and download the library: Download swindon/filament-hashids 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/ */
swindon / filament-hashids example snippets
use Swindon\FilamentHashids\Traits\HasHashid;
class User extends Authenticatable
{
use HasHashid;
// ...
}
use Filament\Panel;
use Filament\PanelProvider;
use Swindon\FilamentHashids\Middleware\FilamentHashidsMiddleware;
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->middleware([
FilamentHashidsMiddleware::class, // Decodes Hashids for all routes in this panel
// ...existing code...
]);
}
}
use Filament\Resources\Resource;
class UserResource extends Resource
{
public static array|string $routeMiddleware = [
'filament-hashids', // Ensures Hashids are decoded for this resource's routes
];
}
bash
php artisan install:filament-hashids
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.