Skip to content

Commit

Permalink
Improve routeIs name match
Browse files Browse the repository at this point in the history
  • Loading branch information
francoism90 authored Aug 12, 2024
1 parent c58a835 commit c298c24
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Support/Html/Mixins/LinkElementMixin.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ public function link(): mixed
/** @var A $this */
$href = route($route, ...$parameters);

$name = str($route)->before('.')->value();

return $this
->attribute('wire:navigate')
->href($href)
->class([
'link',
'link-active' => request()->routeIs($route, "{$route}.*") || request()->fullUrlIs($href),
'link-active' => request()->routeIs($name, "{$name}.*") || request()->fullUrlIs($href),
]);
};
}
Expand Down

0 comments on commit c298c24

Please sign in to comment.