PHP code example of jobmetric / laravel-url

1. Go to this page and download the library: Download jobmetric/laravel-url 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/ */

    

jobmetric / laravel-url example snippets


use JobMetric\Url\HasUrl;

class Product extends Model
{
    use HasUrl;
}

$product = new Product();
$product->name = 'Product 1';
$product->save();

$product->dispatchUrl('slug', 'product');

$product = Product::find(1);
$product->getUrl();

$product = Product::find(1);
$product->url;

$product = Product::find(1);
$product->forgetUrl('product');
bash
php artisan migrate