Open
Description
Create a Permalinkable
interface used by the relevant models so a model instance can be passed to the UrlGenerator
E.g.
$post = Post::find(1);
echo url($post);
This can be useful to quickly get a list of links:
$postLinks = Post::limit(10)->get()->map('url');
Each model type has a different implementation, so the permalink()
method would create a standard API for:
get_permalink()
get_author_posts_url()
get_term_link()
It would also be possible to call the permalink()
method directly, but the interface would make it type checkable.