simplify the routes file a bit
This commit is contained in:
parent
dbb6e9b4fe
commit
5e2bbe69dc
@ -1,14 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
Route::group([
|
Route::group(['middleware' => [
|
||||||
'as' => 'sample.',
|
'role:admin|user' # leave blank to make this public
|
||||||
'prefix' => 'sample',
|
]], function() {
|
||||||
'middleware' => [
|
|
||||||
'web',
|
|
||||||
'role:admin|user' # leave blank for public
|
|
||||||
],
|
|
||||||
'namespace' => 'Modules\Sample\Http\Controllers'
|
|
||||||
], function() {
|
|
||||||
|
|
||||||
# all your routes are prefixed with the above prefix
|
# all your routes are prefixed with the above prefix
|
||||||
# e.g. yoursite.com/sample
|
# e.g. yoursite.com/sample
|
||||||
|
@ -4,6 +4,8 @@ namespace Modules\Sample\Providers;
|
|||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Illuminate\Database\Eloquent\Factory;
|
use Illuminate\Database\Eloquent\Factory;
|
||||||
|
use Route;
|
||||||
|
|
||||||
|
|
||||||
class SampleServiceProvider extends ServiceProvider
|
class SampleServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
@ -42,7 +44,15 @@ class SampleServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
protected function registerRoutes()
|
protected function registerRoutes()
|
||||||
{
|
{
|
||||||
|
Route::group([
|
||||||
|
'as' => 'sample.',
|
||||||
|
'prefix' => 'sample',
|
||||||
|
// If you want a RESTful module, change this to 'api'
|
||||||
|
'middleware' => ['web'],
|
||||||
|
'namespace' => 'Modules\Sample\Http\Controllers'
|
||||||
|
], function() {
|
||||||
$this->loadRoutesFrom(__DIR__ . '/../Http/routes.php');
|
$this->loadRoutesFrom(__DIR__ . '/../Http/routes.php');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,14 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
Route::group([
|
Route::group(['middleware' => [
|
||||||
'as' => '$LOWER_NAME$.',
|
'role:admin|user' # leave blank to make this public
|
||||||
'prefix' => '$LOWER_NAME$',
|
]], function() {
|
||||||
'middleware' => [
|
|
||||||
'web',
|
|
||||||
'role:admin|user' # leave blank for public
|
|
||||||
],
|
|
||||||
'namespace' => '$MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers'
|
|
||||||
], function() {
|
|
||||||
|
|
||||||
# all your routes are prefixed with the above prefix
|
# all your routes are prefixed with the above prefix
|
||||||
# e.g. yoursite.com/sample
|
# e.g. yoursite.com/sample
|
||||||
|
@ -4,6 +4,8 @@ namespace $NAMESPACE$;
|
|||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Illuminate\Database\Eloquent\Factory;
|
use Illuminate\Database\Eloquent\Factory;
|
||||||
|
use Route;
|
||||||
|
|
||||||
|
|
||||||
class $CLASS$ extends ServiceProvider
|
class $CLASS$ extends ServiceProvider
|
||||||
{
|
{
|
||||||
@ -42,7 +44,15 @@ class $CLASS$ extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
protected function registerRoutes()
|
protected function registerRoutes()
|
||||||
{
|
{
|
||||||
|
Route::group([
|
||||||
|
'as' => '$LOWER_NAME$.',
|
||||||
|
'prefix' => '$LOWER_NAME$',
|
||||||
|
// If you want a RESTful module, change this to 'api'
|
||||||
|
'middleware' => ['web'],
|
||||||
|
'namespace' => '$MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers'
|
||||||
|
], function() {
|
||||||
$this->loadRoutesFrom(__DIR__ . '/../Http/routes.php');
|
$this->loadRoutesFrom(__DIR__ . '/../Http/routes.php');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user