italofantone / links
A simple Laravel package to manage links. Polymorphic many-to-many relationship between links and any model.
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/italofantone/links
Requires
- php: >=8.1
- illuminate/database: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^10.6
README
A simple Laravel package to manage links. Polymorphic many-to-many relationship between links and any model.
Example: A Post model can have many links, and a User model can also have many links. Links can be shared among different models.
⚠️ This code was used for educational purposes [...]
Installation
composer require italofantone/links
Usage
- Run migrations:
php artisan migrate
- Use the
Linkabletrait in any model you want to associate links with:
use Italofantone\Links\Traits\Linkable; class Post extends Model { use Linkable; }
- Now you can attach, and detach links with your models:
$post = Post::find(1); $link = Link::find(1); // Attach a link to a post $post->attachLink($link); // Detach a link from a post $post->detachLink($link); // Get all links associated with a post $links = $post->links;
Contact
- Email: hola@italofantone.com
- LinkedIn: italofantone
Donations
If you find this project useful and would like to support its development, you can make a donation via PayPal:
- PayPal: Donate via PayPal
Thank you for your support!