Open BenRutlandWeb opened 1 year ago
Create a Permalinkable interface used by the relevant models so a model instance can be passed to the UrlGenerator E.g.
Permalinkable
UrlGenerator
$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:
permalink()
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.
Create a
Permalinkable
interface used by the relevant models so a model instance can be passed to theUrlGenerator
E.g.This can be useful to quickly get a list of links:
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.