Nano
Nano
FFilament
Created by Nano on 9/17/2024 in #❓┊help
Spatie Media Library deleting S3 files
I was not registering my collections
public function registerMediaCollections(): void
{
$this
->addMediaCollection('artwork_primary')
->singleFile()
->useDisk('s3');

$this
->addMediaCollection('artwork_gallery')
->useDisk('s3');

$this
->addMediaCollection('artwork_documents')
->useDisk('s3');

$this
->addMediaCollection('artwork_share_documents')
->useDisk('s3');
}
public function registerMediaCollections(): void
{
$this
->addMediaCollection('artwork_primary')
->singleFile()
->useDisk('s3');

$this
->addMediaCollection('artwork_gallery')
->useDisk('s3');

$this
->addMediaCollection('artwork_documents')
->useDisk('s3');

$this
->addMediaCollection('artwork_share_documents')
->useDisk('s3');
}
So I did this, it seems to have fixed the problem but i am not sure about it, hopefully someone can confirm or deny it, if no answer comes within a day or so i'll mark as solved 🤷‍♂️
3 replies
FFilament
Created by ericmp on 10/21/2023 in #❓┊help
Problems using Volt
Just saw your comment while looking if it's been done, I think it just actually works
<?php
use function Livewire\Volt\{mount, state, computed};
use App\Models\Schematic;
use function Laravel\Folio\name;
use Illuminate\Support\Facades\Cache;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\MarkdownEditor;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Form;
use Illuminate\Contracts\View\View;
use Livewire\Volt\Component;

new class extends Component implements HasForms {
use InteractsWithForms;
public $shortId;
public $schematicBase64;
public ?array $data = [];

public function mount($shortId)
{
$cacheKey = Cache::get("schematic-temporary-short-links:{$shortId}");
if (!$cacheKey) {
$this->redirect('/schematics');
}
$schematicFile = Cache::get($cacheKey);
$this->schematicBase64 = base64_encode($schematicFile);
$this->form->fill();
}

public function form(Form $form): Form
{
return $form
->schema([
TextInput::make('title')->required(),
MarkdownEditor::make('content'),
// ...
])
->statePath('data');
}
public function create(): void
{
dd($this->form->getState());
}
};
?>


<x-app-layout>
@volt
<div class="max-w-7xl mx-auto">
{{ $shortId }}
<x-schematic-renderer :base64="$schematicBase64" wire:key="schematic-renderer-{{ $shortId }}" />
<form wire:submit="create">
{{ $this->form }}

<button type="submit">
Submit
</button>
</form>
</div>
@endvolt
</x-app-layout>
<?php
use function Livewire\Volt\{mount, state, computed};
use App\Models\Schematic;
use function Laravel\Folio\name;
use Illuminate\Support\Facades\Cache;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\MarkdownEditor;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Form;
use Illuminate\Contracts\View\View;
use Livewire\Volt\Component;

new class extends Component implements HasForms {
use InteractsWithForms;
public $shortId;
public $schematicBase64;
public ?array $data = [];

public function mount($shortId)
{
$cacheKey = Cache::get("schematic-temporary-short-links:{$shortId}");
if (!$cacheKey) {
$this->redirect('/schematics');
}
$schematicFile = Cache::get($cacheKey);
$this->schematicBase64 = base64_encode($schematicFile);
$this->form->fill();
}

public function form(Form $form): Form
{
return $form
->schema([
TextInput::make('title')->required(),
MarkdownEditor::make('content'),
// ...
])
->statePath('data');
}
public function create(): void
{
dd($this->form->getState());
}
};
?>


<x-app-layout>
@volt
<div class="max-w-7xl mx-auto">
{{ $shortId }}
<x-schematic-renderer :base64="$schematicBase64" wire:key="schematic-renderer-{{ $shortId }}" />
<form wire:submit="create">
{{ $this->form }}

<button type="submit">
Submit
</button>
</form>
</div>
@endvolt
</x-app-layout>
Using the volt class based component I had no issue integrating the example
9 replies