Installation
Compatibility
| Filament version | Package version |
|---|---|
| 2.x | 1.x |
| 2.x | 2.x |
| 3.x | 3.x |
| 4.x | 4.x |
| 4.x & 5.x | 5.x |
Curator requires PHP 8.2 or later and filament/filament. It pulls in league/glide for image transformation and enshrined/svg-sanitize for cleaning SVG uploads.
Requiring the package
Install via Composer, then run the installer:
composer require awcodes/filament-curator
php artisan curator:install
What the install command does
curator:install asks a few questions and then writes the files Curator needs into your app.
- Prompts for UUID and tenancy support. It asks whether the media table should use a UUID primary key, and whether Curator should be scoped to a tenant. Answer yes to tenancy and it also asks for the tenant model's name, for example
Team. - Creates the migration. A timestamped
create_curator_table.phpis written todatabase/migrations, creating thecuratortable with the file's storage columns (disk,directory,visibility,name,path,ext,type,size,width,height), its metadata columns (alt,title,description,caption,pretty_name,exif,curations), and a nullable tenant foreign key. The primary key is a UUID or an auto-incrementing ID depending on your answer, and the foreign key is named after your tenant model (team_id), ortenant_idwhen tenancy is off. - Creates a Media model — only if you chose UUID or tenancy.
app/Models/Media.phpextendsAwcodes\Curator\Models\Media, adding Laravel'sHasUuidstrait and/or aBelongsTorelationship to your tenant model. - Publishes and edits the config — also only in that case.
config/curator.phpis published, pointed at your new model, and itstenancyblock switched on with your relationship name. If you skip both options no config file is published; publish it yourself later when you want to change the defaults. See Configuration. - Generates the Glide token. It runs
php artisan curator:token, writingCURATOR_GLIDE_TOKENinto your.env. This one needs attention beyond your own machine — see Glide token. - Offers to run the migrations. Answer yes and it runs
php artisan migrate; answer no and the migration waits indatabase/migrations.
To run it unattended, answer the prompts up front — each option takes a value, so pass --use-uuid=1, --tenancy-name=Team and --run-migrations=1, using 0 to opt out.
Registering the styles
Important
If you have not set up a custom theme and are using Filament Panels, follow the instructions in the Filament documentation first.
Add Curator's styles and views to your theme's CSS file — or your application's CSS file if you are using the standalone packages:
@import '../../../../vendor/awcodes/filament-curator/resources/css/plugin.css';
@source '../../../../vendor/awcodes/filament-curator/resources/**/*.blade.php';
Standalone forms
The picker and the rich editor tool open Filament action modals. In a Livewire component that renders a form outside a panel, render the action modals in its view, as for any Filament action:
<div>
{{ $this->form }}
<x-filament-actions::modals />
</div>
Panel pages already do this.