31 lines
859 B
PHP
31 lines
859 B
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Manage\Partners\Pages;
|
|
|
|
use App\Filament\Actions\BackAction;
|
|
use App\Filament\Resources\Manage\Partners\PartnerResource;
|
|
use Filament\Resources\Pages\ViewRecord;
|
|
|
|
class ViewPartner extends ViewRecord
|
|
{
|
|
protected static string $resource = PartnerResource::class;
|
|
|
|
protected static ?string $title = 'Rekanan';
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
$previousUrl = url()->previous();
|
|
$currentUrl = url()->current();
|
|
$indexUrl = PartnerResource::getUrl('index');
|
|
|
|
// If previous URL is same as current or empty, fallback to index
|
|
$targetUrl = ($previousUrl && $previousUrl !== $currentUrl && $previousUrl !== $indexUrl)
|
|
? $previousUrl
|
|
: $indexUrl;
|
|
|
|
return [
|
|
BackAction::make()->url($targetUrl),
|
|
];
|
|
}
|
|
}
|