PHP code example of laratree / laravel-link

1. Go to this page and download the library: Download laratree/laravel-link library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

laratree / laravel-link example snippets


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


// 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');
bash
php artisan vendor:publish --tag="laravel-link-migrations"

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