diff --git a/docs/05-panel-configuration.md b/docs/05-panel-configuration.md index f436acfa27..a54db08872 100644 --- a/docs/05-panel-configuration.md +++ b/docs/05-panel-configuration.md @@ -31,7 +31,7 @@ php artisan make:filament-panel app This command will create a new panel called "app". A configuration file will be created at `app/Providers/Filament/AppPanelProvider.php`. You can access this panel at `/app`, but you can [customize the path](#changing-the-path) if you don't want that. -Since this configuration file is also a [Laravel service provider](https://laravel.com/docs/providers), it needs to be registered in `bootstrap/providers.php` (Laravel 11 and above) or `config/app.php` (Laravel 10 and below). Filament will attempt to do this for you, but if you get an error while trying to access your panel then this process has probably failed. +Since this configuration file is also a [Laravel service provider](https://laravel.com/docs/providers), it needs to be registered in `bootstrap/providers.php` (Laravel 11 app structure and above) or `config/app.php` (Laravel 10 app structure and below). Filament will attempt to do this for you, but if you get an error while trying to access your panel then this process has probably failed. ## Changing the path diff --git a/packages/actions/docs/11-import.md b/packages/actions/docs/11-import.md index 89b0c2501d..890fb8a431 100644 --- a/packages/actions/docs/11-import.md +++ b/packages/actions/docs/11-import.md @@ -11,17 +11,8 @@ Filament includes an action that is able to import rows from a CSV. When the tri This feature uses [job batches](https://laravel.com/docs/queues#job-batching) and [database notifications](../../notifications/database-notifications), so you need to publish those migrations from Laravel. Also, you need to publish the migrations for tables that Filament uses to store information about imports: ```bash -# Laravel 11 and higher php artisan make:queue-batches-table php artisan make:notifications-table - -# Laravel 10 -php artisan queue:batches-table -php artisan notifications:table -``` - -```bash -# All apps php artisan vendor:publish --tag=filament-actions-migrations php artisan migrate ``` diff --git a/packages/actions/docs/12-export.md b/packages/actions/docs/12-export.md index 08cb28d936..8e84ce1e1a 100644 --- a/packages/actions/docs/12-export.md +++ b/packages/actions/docs/12-export.md @@ -9,17 +9,8 @@ import UtilityInjection from "@components/UtilityInjection.astro" Filament includes an action that is able to export rows to a CSV or XLSX file. When the trigger button is clicked, a modal asks for the columns that they want to export, and what they should be labeled. This feature uses [job batches](https://laravel.com/docs/queues#job-batching) and [database notifications](../../notifications/database-notifications), so you need to publish those migrations from Laravel. Also, you need to publish the migrations for tables that Filament uses to store information about exports: ```bash -# Laravel 11 and higher php artisan make:queue-batches-table php artisan make:notifications-table - -# Laravel 10 -php artisan queue:batches-table -php artisan notifications:table -``` - -```bash -# All apps php artisan vendor:publish --tag=filament-actions-migrations php artisan migrate ``` diff --git a/packages/actions/src/Concerns/InteractsWithActions.php b/packages/actions/src/Concerns/InteractsWithActions.php index 318a88329a..d09ac6590d 100644 --- a/packages/actions/src/Concerns/InteractsWithActions.php +++ b/packages/actions/src/Concerns/InteractsWithActions.php @@ -14,6 +14,7 @@ use Filament\Schemas\Contracts\HasSchemas; use Filament\Schemas\Schema; use Filament\Support\Exceptions\Cancel; use Filament\Support\Exceptions\Halt; +use Filament\Support\Livewire\Partials\PartialsComponentHook; use Filament\Tables\Contracts\HasTable; use Illuminate\Auth\Access\Response; use Illuminate\Database\Eloquent\Model; @@ -309,6 +310,8 @@ trait InteractsWithActions return $result; } + $this->partiallyRenderActionParentSchema($action); + $action->resetArguments(); $action->resetData(); @@ -329,6 +332,28 @@ trait InteractsWithActions return $result; } + protected function partiallyRenderActionParentSchema(Action $action): void + { + $actionSchema = $action->getSchemaContainer() ?? $action->getSchemaComponent()?->getContainer(); + $schemaToPartiallyRender = null; + + while ($actionSchema !== null) { + if ($actionSchema->shouldPartiallyRender()) { + $schemaToPartiallyRender = $actionSchema; + } + + $actionSchema = $actionSchema->getParentComponent()?->getContainer(); + } + + if (! $schemaToPartiallyRender) { + return; + } + + app(PartialsComponentHook::class)->renderPartial($this, fn (): array => [ + "schema.{$schemaToPartiallyRender->getKey()}" => $schemaToPartiallyRender->toHtml(...), + ]); + } + protected function afterActionCalled(): void {} /** @@ -470,7 +495,6 @@ trait InteractsWithActions continue; } - $resolvedAction->mergeArguments($action['arguments'] ?? []); $resolvedAction->nestingIndex($actionNestingIndex); $resolvedAction->boot(); diff --git a/packages/actions/src/Testing/TestsActions.php b/packages/actions/src/Testing/TestsActions.php index 7967b0c789..ed0ee03f61 100644 --- a/packages/actions/src/Testing/TestsActions.php +++ b/packages/actions/src/Testing/TestsActions.php @@ -145,6 +145,10 @@ class TestsActions ...$actions, ]); + if ($action && filled($arguments = Arr::last($actions)['arguments'] ?? [])) { + $action->mergeArguments($arguments); + } + $livewireClass = $this->instance()::class; $prettyName = implode(' > ', Arr::pluck($actions, 'name')); @@ -184,6 +188,10 @@ class TestsActions return $this; } + if ($action && filled($arguments = Arr::last($actions)['arguments'] ?? [])) { + $action->mergeArguments($arguments); + } + $livewireClass = $this->instance()::class; $prettyName = implode(' > ', Arr::pluck($actions, 'name')); diff --git a/packages/forms/src/Components/Concerns/HasFileAttachments.php b/packages/forms/src/Components/Concerns/HasFileAttachments.php index 04c299a7ae..a881b7b712 100644 --- a/packages/forms/src/Components/Concerns/HasFileAttachments.php +++ b/packages/forms/src/Components/Concerns/HasFileAttachments.php @@ -8,6 +8,7 @@ use Illuminate\Contracts\Filesystem\Filesystem; use Illuminate\Filesystem\FilesystemAdapter; use Illuminate\Support\Facades\Storage; use League\Flysystem\UnableToCheckFileExistence; +use Livewire\Attributes\Renderless; use Livewire\Features\SupportFileUploads\TemporaryUploadedFile; use Throwable; @@ -38,6 +39,7 @@ trait HasFileAttachments } #[ExposedLivewireMethod] + #[Renderless] public function getUploadedFileAttachmentTemporaryUrl(TemporaryUploadedFile | string | null $attachment = null): ?string { return $this->getUploadedFileAttachment($attachment)?->temporaryUrl(); @@ -77,6 +79,7 @@ trait HasFileAttachments } #[ExposedLivewireMethod] + #[Renderless] public function saveUploadedFileAttachmentAndGetUrl(): ?string { $attachment = $this->getUploadedFileAttachment(); diff --git a/packages/notifications/docs/02-database-notifications.md b/packages/notifications/docs/02-database-notifications.md index 588e57c097..25049e4d46 100644 --- a/packages/notifications/docs/02-database-notifications.md +++ b/packages/notifications/docs/02-database-notifications.md @@ -11,11 +11,7 @@ import AutoScreenshot from "@components/AutoScreenshot.astro" Before we start, make sure that the [Laravel notifications table](https://laravel.com/docs/notifications#database-prerequisites) is added to your database: ```bash -# Laravel 11 and higher php artisan make:notifications-table - -# Laravel 10 -php artisan notifications:table ``` > If you're using PostgreSQL, make sure that the `data` column in the migration is using `json()`: `$table->json('data')`. diff --git a/packages/schemas/src/Concerns/InteractsWithSchemas.php b/packages/schemas/src/Concerns/InteractsWithSchemas.php index 192fb1dbe6..731ff8f7b8 100644 --- a/packages/schemas/src/Concerns/InteractsWithSchemas.php +++ b/packages/schemas/src/Concerns/InteractsWithSchemas.php @@ -9,6 +9,7 @@ use Filament\Schemas\Components\Component; use Filament\Schemas\Schema; use Filament\Support\Components\Attributes\ExposedLivewireMethod; use Filament\Support\Contracts\TranslatableContentDriver; +use Filament\Support\Livewire\Partials\PartialsComponentHook; use Illuminate\Support\Arr; use Illuminate\Validation\ValidationException; use Livewire\Attributes\Locked; @@ -79,6 +80,23 @@ trait InteractsWithSchemas if ($methodReflection->getAttributes(Renderless::class)) { $this->skipRender(); + } else { + $schema = $component->getContainer(); + $schemaToPartiallyRender = null; + + while ($schema !== null) { + if ($schema->shouldPartiallyRender()) { + $schemaToPartiallyRender = $schema; + } + + $schema = $schema->getParentComponent()?->getContainer(); + } + + if ($schemaToPartiallyRender) { + app(PartialsComponentHook::class)->renderPartial($this, fn (): array => [ + "schema.{$schemaToPartiallyRender->getKey()}" => $schemaToPartiallyRender->toHtml(...), + ]); + } } return $component->{$method}(...$arguments); diff --git a/packages/tables/src/Grouping/Group.php b/packages/tables/src/Grouping/Group.php index ce77200cea..d48913dbba 100644 --- a/packages/tables/src/Grouping/Group.php +++ b/packages/tables/src/Grouping/Group.php @@ -8,6 +8,7 @@ use Carbon\CarbonInterface; use Closure; use Filament\Support\Components\Component; use Filament\Support\Contracts\HasLabel as LabelInterface; +use Filament\Tables\Table; use Illuminate\Contracts\Support\Htmlable; use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Database\Eloquent\Model; @@ -35,7 +36,7 @@ class Group extends Component protected ?Closure $scopeQueryByKeyUsing = null; - protected string | Closure | null $label = null; + protected string | Htmlable | Closure | null $label = null; protected string $id; @@ -88,7 +89,7 @@ class Group extends Component return $this; } - public function label(string | Closure | null $label): static + public function label(string | Htmlable | Closure | null $label): static { $this->label = $label; @@ -181,7 +182,7 @@ class Group extends Component return $this->id; } - public function getLabel(): string + public function getLabel(): string | Htmlable { return $this->evaluate($this->label) ?? (string) str($this->getId()) ->beforeLast('.') @@ -191,7 +192,7 @@ class Group extends Component ->ucfirst(); } - public function getDescription(Model $record, ?string $title): ?string + public function getDescription(Model $record, string | Htmlable | null $title): string | Htmlable | null { if (! $this->getDescriptionFromRecordUsing) { return null;