Skip to content

Commit

Permalink
Check slug in previewUri method
Browse files Browse the repository at this point in the history
  • Loading branch information
sdebacker committed Jan 10, 2024
1 parent bd324df commit 345197f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Models/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ public function uri($locale = null): string
{
$locale = $locale ?: config('app.locale');
$route = $locale . '::' . Str::singular($this->getTable());
if (Route::has($route)) {
return route($route, $this->translate('slug', $locale));
$slug = $this->translate('slug', $locale);
if (Route::has($route) && !empty($slug)) {
return route($route, $slug);
}

return url('/');
Expand Down

0 comments on commit 345197f

Please sign in to comment.