Skip to content

Commit

Permalink
helper/attribute for relative url
Browse files Browse the repository at this point in the history
  • Loading branch information
epalmans committed Jun 10, 2023
1 parent c8d04f8 commit 2dd811b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/SiteView.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,9 @@ public function scopeOlderThanOrBetween(Builder $query, $until = null, $from = n

return $query;
}

public function relativeUrl(): Attribute
{
return Attribute::get(fn () => (string)Str::of($this->url)->after(config('app.url'))->start('/') );
}
}

0 comments on commit 2dd811b

Please sign in to comment.