mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
Merge branch '4.x' into pr/17829
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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'));
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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')`.
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user