🆙 Final fix delete storage link to fix news_images and logs 🆙

This commit is contained in:
Remco
2026-01-07 20:29:24 +01:00
parent 65ea6c167f
commit acf2d7e661
447 changed files with 208 additions and 66965 deletions
@@ -1,69 +0,0 @@
<?php
namespace App\Filament\Resources\Hotel\BadgeUploads;
use App\Filament\Resources\Hotel\BadgeUploads\Pages\ManageBadgeUploads;
use Filament\Forms\Components\FileUpload;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Support\Facades\Storage;
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
class BadgeUploadResource extends Resource
{
protected static string|\UnitEnum|null $navigationGroup = 'Hotel';
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-gif';
protected static ?string $label = 'Badge Upload';
#[\Override]
public static function form(Schema $schema): Schema
{
return $schema
->components([
FileUpload::make('badge_file')
->label('Upload Badge')
->disk('local')
->directory(setting('badge_path_filesystem'))
->required()
->getUploadedFileNameForStorageUsing(
fn (TemporaryUploadedFile $file): string => strtolower(str_replace([' ', '-', 'æ', 'ø', 'å'], ['_', '_', 'ae', 'oe', 'aa'], $file->getClientOriginalName())),
),
]);
}
#[\Override]
public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('filename')
->label('File Name')
->sortable(),
TextColumn::make('path')
->label('File Path'),
])
->filters([]);
}
public static function getPages(): array
{
return [
'index' => ManageBadgeUploads::route('/'),
];
}
public static function getFiles(): array
{
$badgePath = env('BadgePath', 'badges');
$files = Storage::disk('local')->files($badgePath);
return collect($files)->map(fn ($file) => [
'filename' => basename($file),
'path' => $file,
])->toArray();
}
}
@@ -1,48 +0,0 @@
<?php
namespace App\Filament\Resources\Hotel\BadgeUploads\Pages;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\Page; // Import the Notification class
class ManageBadgeUploads extends Page implements HasForms
{
use InteractsWithForms;
public $badge_file;
protected static string $resource = \App\Filament\Resources\Hotel\BadgeUploads\BadgeUploadResource::class;
protected string $view = 'filament.pages.manage-badge-uploads';
public function mount(): void
{
$this->form->fill([]);
}
protected function getFormSchema(): array
{
return [
FileUpload::make('badge_file')
->label('Upload Badge')
->disk('badges')
->preserveFilenames()
->acceptedFileTypes(['image/gif'])
->rules(['mimes:gif'])
->required(),
];
}
public function save(): void
{
$this->form->getState();
Notification::make()
->title('Badge uploaded successfully!')
->success()
->send();
}
}