This commit is contained in:
Dan Harrin
2023-07-29 12:04:51 +01:00
parent 66dfbd910e
commit a0ea80424b
4 changed files with 27 additions and 12 deletions
@@ -12,7 +12,7 @@ Please [follow Spatie's documentation about how to set up their package](https:/
## Using the font provider
In your [panel builder configuration](/docs/panels/configuration), you can use the `font()` method, passing a `provider`:
In your [panel builder configuration](https://filamentphp.com/docs/panels/configuration), you can use the `font()` method, passing a `provider`:
```php
use Filament\FontProviders\SpatieGoogleFontProvider;
@@ -26,7 +26,7 @@ You must also [prepare your Eloquent model](https://spatie.be/docs/laravel-media
## Form component
You may use the field in the same way as the [original file upload](/docs/forms/fields/file-upload) field:
You may use the field in the same way as the [original file upload](https://filamentphp.com/docs/forms/fields/file-upload) field:
```php
use Filament\Forms\Components\SpatieMediaLibraryFileUpload;
@@ -34,9 +34,9 @@ use Filament\Forms\Components\SpatieMediaLibraryFileUpload;
SpatieMediaLibraryFileUpload::make('avatar')
```
The media library file upload supports all the customization options of the [original file upload component](/docs/forms/fields/file-upload).
The media library file upload supports all the customization options of the [original file upload component](https://filamentphp.com/docs/forms/fields/file-upload).
> The field will automatically load and save its uploads to your model. To set this functionality up, **you must also follow the instructions set out in the [field relationships](/docs/forms/getting-started#field-relationships) section**. If you're using a [panel](../panels), you can skip this step.
> The field will automatically load and save its uploads to your model. To set this functionality up, **you must also follow the instructions set out in the [field relationships](https://filamentphp.com/docs/forms/getting-started#field-relationships) section**. If you're using a [panel](../panels), you can skip this step.
### Passing a collection
@@ -49,6 +49,21 @@ SpatieMediaLibraryFileUpload::make('avatar')
->collection('avatars')
```
### Configuring the storage disk and directory
By default, files will be uploaded publicly to your storage disk defined in the [Filament configuration file](https://filamentphp.com/docs/forms/installation#publishing-configuration). You can also set the `FILAMENT_FILESYSTEM_DISK` environment variable to change this. Spatie's disk configuration will not be used. This is to ensure consistency between all Filament packages.
You may set the disk for uploading files with the `disk()` method:
```php
use Filament\Forms\Components\FileUpload;
FileUpload::make('attachment')
->disk('s3')
```
The base file upload component also has configuration options for setting the `directory()` and `visibility()` of uploaded files. These are not used by the media library file upload component. Spatie's package has its own system for determining the directory of a newly-uploaded file, and it does not support uploading private files out of the box. One way to store files privately is to configure this in your S3 bucket settings, in which case you should also use `visibility('private')` to ensure that Filament generates temporary URLs for your files.
### Reordering files
In addition to the behaviour of the normal file upload, Spatie's Media Library also allows users to reorder files.
@@ -135,7 +150,7 @@ use Filament\Tables\Columns\SpatieMediaLibraryImageColumn;
SpatieMediaLibraryImageColumn::make('avatar')
```
The media library image column supports all the customization options of the [original image column](/docs/tables/columns/image).
The media library image column supports all the customization options of the [original image column](https://filamentphp.com/docs/tables/columns/image).
### Passing a collection
@@ -171,7 +186,7 @@ use Filament\Infolists\Components\SpatieMediaLibraryImageEntry;
SpatieMediaLibraryImageEntry::make('avatar')
```
The media library image entry supports all the customization options of the [original image entry](/docs/infolists/entries/image).
The media library image entry supports all the customization options of the [original image entry](https://filamentphp.com/docs/infolists/entries/image).
### Passing a collection
@@ -34,7 +34,7 @@ protected static string $settings = FooterSettings::class;
You must define a form schema to interact with your settings class inside the `form()` method.
Since the [form builder](/docs/forms) is installed in the panel builder by default, you may use any form [fields](/docs/forms/fields) or [layout components](/docs/forms/layout) you like:
Since the [form builder](https://filamentphp.com/docs/forms) is installed in the panel builder by default, you may use any form [fields](https://filamentphp.com/docs/forms/fields) or [layout components](https://filamentphp.com/docs/forms/layout) you like:
```php
use Filament\Forms\Components\Repeater;
@@ -28,7 +28,7 @@ You must also [prepare your Eloquent model](https://spatie.be/docs/laravel-tags/
This guide assumes that you've already set up your model attach tags as per [Spatie's documentation](https://spatie.be/docs/laravel-tags/basic-usage/using-tags).
You may use the field in the same way as the [original tags input](/docs/forms/fields/tags-input) field:
You may use the field in the same way as the [original tags input](https://filamentphp.com/docs/forms/fields/tags-input) field:
```php
use Filament\Forms\Components\SpatieTagsInput;
@@ -36,7 +36,7 @@ use Filament\Forms\Components\SpatieTagsInput;
SpatieTagsInput::make('tags')
```
> The field will automatically load and save its tags to your model. To set this functionality up, **you must also follow the instructions set out in the [field relationships](/docs/forms/getting-started#field-relationships) section**. If you're using the [panel builder](../panels), you can skip this step.
> The field will automatically load and save its tags to your model. To set this functionality up, **you must also follow the instructions set out in the [field relationships](https://filamentphp.com/docs/forms/getting-started#field-relationships) section**. If you're using the [panel builder](../panels), you can skip this step.
Optionally, you may pass a [`type()`](https://spatie.be/docs/laravel-tags/advanced-usage/using-types) allows you to group tags into collections:
@@ -47,7 +47,7 @@ SpatieTagsInput::make('tags')
->type('categories')
```
The tags input supports all the customization options of the [original tags input component](/docs/forms/fields/tags-input).
The tags input supports all the customization options of the [original tags input component](https://filamentphp.com/docs/forms/fields/tags-input).
## Table column
@@ -72,7 +72,7 @@ SpatieTagsColumn::make('tags')
The [type](https://spatie.be/docs/laravel-tags/advanced-usage/using-types) allows you to group tags into collections.
The tags column supports all the customization options of the [original tags column](/docs/tables/columns/tags).
The tags column supports all the customization options of the [original tags column](https://filamentphp.com/docs/tables/columns/tags).
## Infolist entry
@@ -97,4 +97,4 @@ SpatieTagsEntry::make('tags')
The [type](https://spatie.be/docs/laravel-tags/advanced-usage/using-types) allows you to group tags into collections.
The tags entry supports all the customization options of the [text entry](/docs/infolists/entries/text).
The tags entry supports all the customization options of the [text entry](https://filamentphp.com/docs/infolists/entries/text).