hasnhasan/routable

此包的最新版本(dev-master)没有提供许可证信息。

Elequent Model Routable

dev-master 2021-09-08 23:42 UTC

This package is not auto-updated.

Last update: 2024-09-15 12:41:43 UTC


README

## 安装 composer require hasnhasan/routable

## 使用 class Blog extends Model { use Routable;

    public $routeName = 'blogController@detail'; //required
    public $slugColumn = 'title'; 
    public $slugPrefix = 'blog';
    
    ....
}


$blog = Blog::create([
    'title' => 'New Blog Item',
    '_route' => [ // Optional
        'title'       => 'Seo Title',
        'description' => 'seo Description',
        'keywords'    => 'seo keywords',
    ],
]);

dd($blog->route);

$blog = Blog::whereSlug('slug-key')->first();
dd($blog);