48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\PhotoGeoData\Pages;
|
|
|
|
use App\Filament\Resources\PhotoGeoData\PhotoGeoDataResource;
|
|
use App\Filament\Resources\PhotoGeoData\Pages\Concerns\HandlesImageMetadata;
|
|
use Filament\Resources\Pages\CreateRecord;
|
|
|
|
class CreatePhotoGeoData extends CreateRecord
|
|
{
|
|
use HandlesImageMetadata;
|
|
|
|
protected static string $resource = PhotoGeoDataResource::class;
|
|
protected ?string $heading = 'Lägg till bild';
|
|
|
|
|
|
protected function getRedirectUrl(): string
|
|
{
|
|
return \App\Filament\Pages\ThankYou::getUrl([]);
|
|
}
|
|
|
|
public function getBreadcrumbs(): array
|
|
{
|
|
if(auth()->user()?->role === 'user') {
|
|
return [];
|
|
}
|
|
|
|
return parent::getBreadcrumbs();
|
|
}
|
|
|
|
|
|
protected function getFormActions(): array
|
|
{
|
|
return [
|
|
$this->getCreateFormAction(),
|
|
$this->getCancelFormAction(),
|
|
];
|
|
}
|
|
|
|
protected function afterCreate(): void
|
|
{
|
|
$this->syncMetadataFromImage();
|
|
|
|
session()->flash('created_record', $this->record->only([
|
|
'title', 'uploaded_by', 'captured_at', 'lat', 'lng', 'desc', 'story', 'image_path',
|
|
]));
|
|
}
|
|
}
|