Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permalinkable interface #176

Open
BenRutlandWeb opened this issue Mar 3, 2023 · 0 comments
Open

Permalinkable interface #176

BenRutlandWeb opened this issue Mar 3, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@BenRutlandWeb
Copy link
Collaborator

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.

@BenRutlandWeb BenRutlandWeb self-assigned this Mar 3, 2023
@BenRutlandWeb BenRutlandWeb added the enhancement New feature or request label Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant