radiate-framework / framework

A WordPress plugin and theme framework
https://radiate-framework.github.io/
MIT License
4 stars 0 forks source link

Permalinkable interface #176

Open BenRutlandWeb opened 1 year ago

BenRutlandWeb commented 1 year ago

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:

It would also be possible to call the permalink() method directly, but the interface would make it type checkable.