derbala / routers
this package used to fetch data from routes
dev-master
2022-12-14 13:37 UTC
Requires
- php: ^8.1
- acmepackage/laravel-admin: ^1.1
- illuminate/support: ~5.5|~6.0|~7.0|~8.0|~9.0
This package is auto-updated.
Last update: 2025-02-14 18:13:58 UTC
README
Fetch data from routes to permissions table and create pivot table between permissions and routes
Requirements
Laravel >=9
PHP >= 8.0
Laravel-Admin >= dev-main
Features
- Routes Table
- Permissions Table
- permission_routes Table
Installation
- Run
composer require derbala/routers
- Publish vendor
php artisan vendor:publish --provider="derbala\routers\RouterServiceProvider"
- Add routes function to the permission model:
public function routes(){ return $this->belongsToMany(Route::class)->withTimestamps(); }
- Run migrate:
php artisan migrate
- Run the following command to fetch data to routes and permissions tables:
if you want to fetch many routes so you need to put '_' between routes name. to allow translate put 1 in second arugment, otherwise, put 0. For example, if you have 3 routes called admin, metadata and dashboard and you want to fetch them you will run the follwing command:php artisan fetch:routes {route name} {allow translate}
php artisan fetch:routes admin_metadata_dashboard 1
- Run the following command to create pivot table between permissions and routes:
php artisan fetch:permission_routes