Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
[ci skip] [skip ci]
  • Loading branch information
StyleCIBot committed Oct 18, 2023
1 parent d52cfc2 commit 0bd0b2a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/macros.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,22 @@

$wrapper = $this->attributes['wrapper'] ?? [];
$wrapper['target'] ??= $target;
$wrapper['href'] = function($crud, $column, $entry, $related_key) use ($routeName, $parameters) {

$wrapper['href'] = function ($crud, $column, $entry, $related_key) use ($routeName, $parameters) {
if (count($parameters) === 1) {
$entity = $crud->isAttributeInRelationString($column) ? Str::before($column['entity'], '.') : $column['entity'];
$parameterValue = $related_key ?? $entry->{$entity}?->getKey();
if (! $parameterValue) {
return null;
}

return route($routeName, [$parameters[0] => $parameterValue]);
}

return route($routeName);
};
$this->wrapper($wrapper);

return $this;
});
}
Expand Down

0 comments on commit 0bd0b2a

Please sign in to comment.