Skip to content

Commit

Permalink
style: fix code styling
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-frey authored and github-actions[bot] committed Nov 16, 2023
1 parent 7f147f4 commit d3e8da6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
14 changes: 8 additions & 6 deletions src/Pages/NestedEditRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Guava\Filament\NestedResources\Pages;

use Filament\Forms\Form;
use Filament\Actions\DeleteAction;
use Filament\Actions\ViewAction;
use Filament\Forms\Form;
use Filament\Infolists\Infolist;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;

class NestedEditRecord extends EditRecord
Expand All @@ -17,7 +17,7 @@ protected function configureDeleteAction(DeleteAction $action): void
$resource = static::getResource();
$ancestor = $resource::getAncestor();

if (!$ancestor) {
if (! $ancestor) {
parent::configureDeleteAction($action);

return;
Expand All @@ -35,7 +35,8 @@ protected function configureDeleteAction(DeleteAction $action): void
: $ancestorResource::getUrl('edit', [
...$ancestor->getNormalizedRouteParameters($this->getRecord()),
])
);
)
;
}

protected function configureViewAction(ViewAction $action): void
Expand All @@ -45,12 +46,13 @@ protected function configureViewAction(ViewAction $action): void
$action
->authorize($resource::canView($this->getRecord()))
->infolist(fn (Infolist $infolist): Infolist => static::getResource()::infolist($infolist->columns(2)))
->form(fn (Form $form): Form => static::getResource()::form($form));
->form(fn (Form $form): Form => static::getResource()::form($form))
;

if ($resource::hasPage('view')) {
$action->url(fn (): string => static::getResource()::getUrl('view', [
...static::getResource()::getAncestor()->getNormalizedRouteParameters($this->getRecord()),
'record' => $this->getRecord()
'record' => $this->getRecord(),
]));
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/Pages/NestedViewRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Guava\Filament\NestedResources\Pages;

use Filament\Forms\Form;
use Filament\Actions\EditAction;
use Filament\Forms\Form;
use Filament\Resources\Pages\ViewRecord;

class NestedViewRecord extends ViewRecord
Expand All @@ -16,12 +16,13 @@ protected function configureEditAction(EditAction $action): void

$action
->authorize($resource::canEdit($this->getRecord()))
->form(fn (Form $form): Form => static::getResource()::form($form));
->form(fn (Form $form): Form => static::getResource()::form($form))
;

if ($resource::hasPage('edit')) {
$action->url(fn (): string => static::getResource()::getUrl('edit', [
...static::getResource()::getAncestor()->getNormalizedRouteParameters($this->getRecord()),
'record' => $this->getRecord()
'record' => $this->getRecord(),
]));
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

use function Filament\Support\get_model_label;

if (!function_exists('Guava\Filament\NestedResources\get_model_route_parameter')) {
if (! function_exists('Guava\Filament\NestedResources\get_model_route_parameter')) {
function get_model_route_parameter(string | Model $model): string
{
return str(get_model_label(is_string($model) ? $model : $model::class))->camel() . 'Record';
}
}

if (!function_exists('Guava\Filament\NestedResources\get_resource_route_parameter')) {
if (! function_exists('Guava\Filament\NestedResources\get_resource_route_parameter')) {
function get_resource_route_parameter(string | Resource $resource): string
{
return get_model_route_parameter($resource::getModel());
Expand Down

0 comments on commit d3e8da6

Please sign in to comment.