fixed migrations, changed settings to global settings, changed image list to have a "delete all" button instead of "create", fixed printing, added imagick for printing.
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ImageResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ImageResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateImage extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ImageResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('index');
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Illuminate\Contracts\Pagination\Paginator;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
class ListImages extends ListRecords
|
||||
{
|
||||
@@ -15,7 +17,25 @@ class ListImages extends ListRecords
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
Actions\Action::make('delete_all')
|
||||
->label('Delete All Images')
|
||||
->icon('heroicon-o-trash')
|
||||
->color('danger')
|
||||
->requiresConfirmation()
|
||||
->action(function () {
|
||||
// Delete all images from storage
|
||||
Storage::disk('public')->deleteDirectory('images');
|
||||
Storage::disk('public')->makeDirectory('images');
|
||||
|
||||
// Show success notification
|
||||
Notification::make()
|
||||
->title('All images deleted successfully')
|
||||
->success()
|
||||
->send();
|
||||
|
||||
// Refresh the page
|
||||
$this->redirect(static::getUrl());
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user