LaravelPackages.net
Acme Inc.
Toggle sidebar
arifmahmudrana/laravel-resource-route-wildcard-alias

Laravel resource route wildcard alias to use same model name in route model binding with alias

21
1
v1.0.0
About arifmahmudrana/laravel-resource-route-wildcard-alias

arifmahmudrana/laravel-resource-route-wildcard-alias is a Laravel package for laravel resource route wildcard alias to use same model name in route model binding with alias. It currently has 1 GitHub stars and 21 downloads on Packagist (latest version v1.0.0). Install it with composer require arifmahmudrana/laravel-resource-route-wildcard-alias. Discover more Laravel packages by arifmahmudrana or browse all Laravel packages to compare alternatives.

Last updated

:Laravel 5 Resource Route Wildcard Alias

Usage

Step 1: Install Through Composer

composer require arifmahmudrana/laravel-resource-route-wildcard-alias

Step 2: Add the Service Provider

Add service providers to providers array in config/app.php. Like so:

AriMahmudRana\laravelResourceRouteWildcardAlias\LaravelResourceRouteWildcardAliasServiceProvider::class

and that's it.

Examples

Create resource routes with aliases.

Route::group(['middleware' => ['web']], function () {
    Route::resource('album.photo.hello', 'PhotoController', ['alias' => ['album' => 'a', 'photo' => 'p', 'hello' => 'h']]);
});

and the output in php artisan route:list is.

+--------+-----------+------------------------------------+---------------------------+----------------------------------------------+------------+
| Domain | Method    | URI                                | Name                      | Action                                       | Middleware |
+--------+-----------+------------------------------------+---------------------------+----------------------------------------------+------------+
|        | GET|HEAD  | /                                  |                           | Closure                                      |            |
|        | POST      | album/{a}/photo/{p}/hello          | album.photo.hello.store   | App\Http\Controllers\PhotoController@store   | web        |
|        | GET|HEAD  | album/{a}/photo/{p}/hello          | album.photo.hello.index   | App\Http\Controllers\PhotoController@index   | web        |
|        | GET|HEAD  | album/{a}/photo/{p}/hello/create   | album.photo.hello.create  | App\Http\Controllers\PhotoController@create  | web        |
|        | DELETE    | album/{a}/photo/{p}/hello/{h}      | album.photo.hello.destroy | App\Http\Controllers\PhotoController@destroy | web        |
|        | PUT|PATCH | album/{a}/photo/{p}/hello/{h}      | album.photo.hello.update  | App\Http\Controllers\PhotoController@update  | web        |
|        | GET|HEAD  | album/{a}/photo/{p}/hello/{h}      | album.photo.hello.show    | App\Http\Controllers\PhotoController@show    | web        |
|        | GET|HEAD  | album/{a}/photo/{p}/hello/{h}/edit | album.photo.hello.edit    | App\Http\Controllers\PhotoController@edit    | web        |
+--------+-----------+------------------------------------+---------------------------+----------------------------------------------+------------+

License

Released under the MIT License, see LICENSE.

Comments