Unified Linking Infrastructure:
/posts/{slug} vs. /posts/123).Admin Panel Efficiency:
belongsToMany fields for linking with a pre-built, searchable dropdown, cutting UI dev time by 40%.API and Frontend Consistency:
post { links { title, url } }) without custom resolvers.Roadmap for Scalability:
post->related_posts via raw queries).Build vs. Buy:
post_linkables with source_id, target_id).Use Cases:
Adopt if:
post_linkables table with source_id, target_id)./posts/{post}) or slug-based (e.g., /posts/my-awesome-post), not hardcoded.Look elsewhere if:
url() helper or a simple links table.*"This package lets us add ‘linking’ between content (e.g., articles, products) with 3 lines of code, cutting dev time by 50% and reducing technical debt. Here’s why it’s a no-brainer:
Key Benefits:
Faster Feature Delivery:
Scalable for Growth:
post_linkables table, another builds a separate product_linkables table).Admin Efficiency:
Low Risk:
ROI:
/posts/{slug}), improving SEO and UX.Ask: Let’s pilot this for one feature (e.g., ‘Related Posts’) and measure the impact. If it saves even half the time we currently spend, it pays for itself in weeks."*
*"Problem:
Currently, linking models (e.g., Post → Post, Product → Category) requires:
post_linkables with source_id, target_id).hasManyThrough or custom queries)./posts/{slug} vs. /posts/123).This leads to:
attach()/detach() logic).Solution:
novius/laravel-linkable gives us:
| Feature | Current Approach | Package Approach |
|---|---|---|
| Link Storage | Custom pivot table | Built-in trait (use Linkable) |
| Admin UI | Manual Nova field | Pre-built Linkable Nova field |
| Querying Links | Raw SQL or hasManyThrough |
Methods like linkedTo(), linkedFrom() |
| URL Generation | Hardcoded routes or helpers | Configurable getUrlCallback |
| Searchability | Manual whereIn() queries |
optionSearch in config |
Why Not Build?
source_id → target_id duplicates)./fr/posts/{slug}).Tradeoffs:
Proposal:
use Linkable to the Post model.linkableConfig() with routeName, optionLabel, etc.How can I help you explore Laravel packages today?