with using this package, you can manage the header status code of routes. you can redirect or abort routes with status code. I try to create this package like Wordpress Yoast plugin.
Via Composer
$ composer require amiraghaee/redirectorTo adjust the package to your needs, you can publish the config file config/redirector.php to your project's config folder using:
$ php artisan vendor:publish --tag=redirectorThis package already support two data engine!
- Redis
- Eloquent
Strongly we recommend Redis database! Eloquent maybe affect to speed of your website.
Default data engine is redis, but you can change it in config/redirector.php.
accepted values are 'redis' and 'eloquent'
'engine' => 'eloquent',If you have selected the Eloquent data engine, you must run the migration command to add the "redirector" table to the database.
$ php artisan migrateUse redirector namespace on top of your controller or wherever you want:
use AmirAghaee\Redirector\Facades\Redirector;You can add roles with this method. it will be return boolean value.
Redirector::set($route, $status, $endpoint);| Parameter | Required | Description | Type |
|---|---|---|---|
| route | yes | The source route that you want to change the header status | string |
| status | yes | header status code. 300 range for redirect and 400 for abort | integer |
| endpoint | No | if status code was in 300 range, request will be redirect to this route | string |
You can get all roles with this method. this method will be return collocation type value.
Redirector::all();You can get specific role with this method. this method will be return collocation type value.
Redirector::get($route);| Parameter | Required | Description | Type |
|---|---|---|---|
| route | yes | The source route that you want get | string |
You can delete specific role with this method. this method will be return collocation type value.
Redirector::delete($route);| Parameter | Required | Description | Type |
|---|---|---|---|
| route | yes | The source route that you want get | string |
You can delete all roles with this command.
$ php artisan redirector:refreshMIT. Please see the license file for more information.
- Add command for fresh database!
- Add eloquent database!
- Add redis database!
- Add cache to eloquent database!