laratree/laravel-link

Associate models with URL links

v1.0.1 2023-11-06 06:40 UTC

README

Latest Version on Packagist GitHub Tests Action Status codecov Total Downloads

Associate models with URL links.

Installation

You can install the package via composer:

composer require laratree/laravel-link

You can publish and run the migrations with:

php artisan vendor:publish --tag="laravel-link-migrations"

php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag=":laravel-link"

This is the contents of the published config file:

return [
    'table' => 'links',
];

Usage

// Register Trait on User model.
use HasLink;

// Attach Link to User
$user = User::latest()->first();
$user->attachLink($url = 'https://portfolio.com');

// Delete Link
$user->deleteLink('https://portfolio.com');

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.