Skip to content

Set Priority While Using Models #412

Answered by HassanZahirnia
Blair2004 asked this question in Q&A
Discussion options

You must be logged in to vote

Any news on this ?

Edit: Actually few minutes after posting this, I found the solution and it was pretty simple. 😄
In the model instead of returning a string, just return the Url object like so:

public function toSitemapTag(): Url | string | array
{
   return Url::create( route('blog.post.show', $this) )
                ->setPriority(0.7);
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by freekmurze
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants