Skip to content

Permalinkable interface #176

Description

@BenRutlandWeb

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions