本文整理汇总了PHP中Illuminate\Support\Facades\Route::group方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::group方法的具体用法?PHP Route::group怎么用?PHP Route::group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Route
的用法示例。
在下文中一共展示了Route::group方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mapApiRoutes
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{
Route::group(['middleware' => 'api', 'namespace' => $this->namespace, 'prefix' => 'api'], function () {
/** @noinspection PhpIncludeInspection */
require base_path('routes/api.php');
});
}
示例2: mapAuthRoutes
protected function mapAuthRoutes()
{
Route::group(['middleware' => 'web', 'namespace' => $this->namespace], function ($router) {
Route::auth();
Route::get('/logout', 'Auth\\LoginController@logout');
});
}
示例3: initializationModule
public function initializationModule()
{
$this->modulePath = app_path('Modules/' . $this->moduleName);
//Config
if (file_exists($this->modulePath . '/config.php')) {
$this->mergeConfigFrom($this->modulePath . '/config.php', 'module' . $this->moduleName);
}
//Language
if (is_dir($this->modulePath . '/Languages')) {
$this->app->language->load($this->moduleName);
}
//Helper
if (file_exists($this->modulePath . '/helpers.php')) {
require $this->modulePath . '/helpers.php';
}
//View
if (is_dir($this->modulePath . '/Views')) {
$this->loadViewsFrom($this->modulePath . '/Views', $this->moduleName);
}
//Hook View
if (isset($this->hookView)) {
foreach ($this->hookView as $key => $value) {
$this->app->config->set('hooks.' . $key, $value);
}
}
//Widget
if (isset($this->widget)) {
foreach ($this->widget as $key => $value) {
$this->app->widget->register($key, $value);
}
}
//Cast
if (isset($this->castPost)) {
foreach ($this->castPost as $key => $value) {
$this->app->config->set('site.cast.post.' . $key, $value);
}
}
if (isset($this->castCategory)) {
foreach ($this->castCategory as $key => $value) {
$this->app->config->set('site.cast.category.' . $key, $value);
}
}
//Permissions
if (isset($this->permissions)) {
foreach ($this->permissions as $key => $value) {
$this->app->config->set('site.permissions.' . $key, $value);
}
}
//Route
if (file_exists($this->modulePath . '/Routes/web.php')) {
Route::group(['middleware' => 'web', 'namespace' => 'App\\Modules\\' . $this->moduleName . '\\Controllers'], function ($router) {
require $this->modulePath . '/Routes/web.php';
});
}
if (file_exists($this->modulePath . '/Routes/api.php')) {
Route::group(['middleware' => 'api', 'namespace' => $this->namespace, 'prefix' => 'api'], function ($router) {
require $this->modulePath . '/Routes/api.php';
});
}
}
示例4: boot
public function boot()
{
$this->package('mrosati84/laradmin');
$prefix = Config::get('laradmin::prefix');
$namespace = Config::get('laradmin::namespace');
$entities = Config::get('laradmin::entities');
foreach ($entities as $entity => $properties) {
$fullClassName = $namespace . '\\' . $entity . 'Admin';
$baseAdminController = 'Mrosati84\\Laradmin\\BaseAdminController';
// register admin classes bindings
App::bind($fullClassName, function () use($fullClassName, $entity) {
return new $fullClassName($entity);
});
// register custom filters classes
App::bind('AuthenticationFilter', 'Mrosati84\\Laradmin\\Filters\\AuthenticationFilter');
// register custom route filters
Route::filter('laradmin.auth', 'AuthenticationFilter');
// register laradmin index route (just a redirect to default entity)
Route::get($prefix, array('as' => 'laradmin.index', function () use($prefix) {
return Redirect::route($prefix . '.' . strtolower(Config::get('laradmin::defaultEntity')) . '.index');
}));
// register entities routes
Route::group(array('prefix' => $prefix, 'before' => 'laradmin.auth'), function () use($entity, $fullClassName) {
Route::resource(strtolower($entity), $fullClassName);
});
}
}
示例5: map
/**
* Define the routes for the application.
*
* @return void
*/
public function map()
{
if (!$this->app->routesAreCached()) {
Route::group(['namespace' => 'EscapeWork\\LaraMedias\\Http\\Controllers'], function () {
require __DIR__ . '/../Http/routes.php';
});
}
}
示例6: map
/**
* Define the routes for the application.
*
* @return void
*/
public function map()
{
Route::group(['namespace' => $this->namespace], function ($router) {
foreach (glob(app_path('Http//Routes') . '/*.php') as $file) {
$this->app->make('Pterodactyl\\Http\\Routes\\' . basename($file, '.php'))->map($router);
}
});
}
示例7: mapApiRoutes
/**
* Define the "api" routes for the theme. Routes are in two groups, those requiring
* a user to be authenticated and another for routes that don't require any authentication.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{
Route::group(['middleware' => ['api', 'auth:api'], 'namespace' => 'App\\Http\\Controllers', 'prefix' => 'api'], function ($router) {
$this->loadRouteFile('api');
});
Route::group(['middleware' => ['api'], 'namespace' => 'App\\Http\\Controllers', 'prefix' => 'api'], function ($router) {
$this->loadRouteFile('api-no-auth');
});
}
示例8: registerRoutes
public function registerRoutes()
{
Route::group(array('prefix' => Config::get('clumsy/form-builder::input-prefix'), 'before' => array_merge(array('clumsy'), (array) Config::get('clumsy/form-builder::input-filters-before')), 'after' => Config::get('clumsy/form-builder::input-filters-after')), function () {
$sections = app('form-builder')->getSections();
foreach ($sections->getAllItems() as $section) {
Route::resource($section->getResource(), 'Clumsy\\FormBuilder\\Controllers\\FormController');
}
});
}
示例9: testRoutes
public function testRoutes()
{
Route::group(['middleware' => ['web']], function () {
Route::group(['middleware' => ['auth']], function () {
Route::get('/happybirthday/test/now', '\\Willypuzzle\\Happybirthday\\Http\\Controllers\\TestController@now');
Route::get('/happybirthday/test/date/{date}', '\\Willypuzzle\\Happybirthday\\Http\\Controllers\\TestController@date');
});
});
}
示例10: mapWebRoutes
/**
* Define the "web" routes for the application.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
protected function mapWebRoutes()
{
Route::group(['namespace' => $this->namespace, 'middleware' => config('amigridview.middleware'), 'prefix' => config('amigridview.prefix')], function ($router) {
/** @var \Illuminate\Routing\Router $router */
$routesFile = __DIR__ . '/../Http/routes.php';
if (file_exists($routesFile)) {
require $routesFile;
}
});
}
示例11: boot
/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot()
{
// Publish pieces
if (!$this->isLumen()) {
$this->publishes([__DIR__ . '/../config/mail-tracker.php' => config_path('mail-tracker.php')], 'config');
$this->publishes([__DIR__ . '/../migrations/2016_03_01_193027_create_sent_emails_table.php' => database_path('migrations/2016_03_01_193027_create_sent_emails_table.php')], 'config');
$this->publishes([__DIR__ . '/../migrations/2016_09_07_193027_create_sent_emails_Url_Clicked_table.php' => database_path('migrations/2016_09_07_193027_create_sent_emails_Url_Clicked_table.php')], 'config');
$this->publishes([__DIR__ . '/../migrations/2016_11_10_213551_add-message-id-to-sent-emails-table.php' => database_path('migrations/2016_11_10_213551_add-message-id-to-sent-emails-table.php')], 'config');
$this->loadViewsFrom(__DIR__ . '/views', 'emailTrakingViews');
$this->publishes([__DIR__ . '/views' => base_path('resources/views/vendor/emailTrakingViews')]);
}
// Hook into the mailer
$this->app['mailer']->getSwiftMailer()->registerPlugin(new MailTracker());
// Install the routes
$config = $this->app['config']->get('mail-tracker.route', []);
$config['namespace'] = 'jdavidbakr\\MailTracker';
if (!$this->isLumen()) {
Route::group($config, function () {
Route::get('t/{hash}', 'MailTrackerController@getT')->name('mailTracker_t');
Route::get('l/{url}/{hash}', 'MailTrackerController@getL')->name('mailTracker_l');
Route::post('sns', 'SNSController@callback')->name('mailTracker_SNS');
});
} else {
$app = $this->app;
$app->group($config, function () use($app) {
$app->get('t', 'MailTrackerController@getT')->name('mailTracker_t');
$app->get('l', 'MailTrackerController@getL')->name('mailTracker_l');
$app->post('sns', 'SNSController@callback')->name('mailTracker_SNS');
});
}
// Install the Admin routes
$config_admin = $this->app['config']->get('mail-tracker.admin-route', []);
$config_admin['namespace'] = 'jdavidbakr\\MailTracker';
if (!$this->isLumen()) {
Route::group($config_admin, function () {
Route::get('/', 'AdminController@getIndex')->name('mailTracker_Index');
Route::post('search', 'AdminController@postSearch')->name('mailTracker_Search');
Route::get('clear-search', 'AdminController@clearSearch')->name('mailTracker_ClearSearch');
Route::get('show-email/{id}', 'AdminController@getShowEmail')->name('mailTracker_ShowEmail');
Route::get('url-detail/{id}', 'AdminController@getUrlDetail')->name('mailTracker_UrlDetail');
Route::get('smtp-detail/{id}', 'AdminController@getSmtpDetail')->name('mailTracker_SmtpDetail');
});
} else {
$app = $this->app;
$app->group($config_admin, function () use($app) {
$app->get('/', 'AdminController@getIndex')->name('mailTracker_Index');
$app->post('search', 'AdminController@postSearch')->name('mailTracker_Search');
$app->get('clear-search', 'AdminController@clearSearch')->name('mailTracker_ClearSearch');
$app->get('show-email/{id}', 'AdminController@getShowEmail')->name('mailTracker_ShowEmail');
$app->get('url-detail/{id}', 'AdminController@getUrlDetail')->name('mailTracker_UrlDetail');
$app->get('smtp-detail/{id}', 'AdminController@getSmtpDetail')->name('mailTracker_SmtpDetail');
});
}
}
示例12: addRoutes
protected function addRoutes($controllerNamespace, $routeFolder)
{
Route::group(['namespace' => $controllerNamespace, 'prefix' => config('trungtnm.backend.uri')], function () use($routeFolder) {
// scan routes php file in route folder -> route folder should contain only Laravel routes define
$pattern = $routeFolder . '/*.php';
$modules = glob($pattern);
foreach ($modules as $routerPath) {
require $routerPath;
}
});
}
示例13: map
/**
* Define the routes for the application.
*/
public function map()
{
Route::group(['namespace' => $this->namespace], function (Registrar $router) {
foreach (glob(app_path('Http//Routes') . '/*.php') as $file) {
$namespace = basename($file, '.php');
$router->group(['namespace' => $namespace], function (Registrar $router) use($namespace) {
$this->app->make("App\\Http\\Routes\\{$namespace}")->map($router);
});
}
});
}
示例14: defineRoutes
/**
* Define the Spark routes.
*
* @return void
*/
protected function defineRoutes()
{
$this->defineRouteBindings();
// If the routes have not been cached, we will include them in a route group
// so that all of the routes will be conveniently registered to the given
// controller namespace. After that we will load the Spark routes file.
if (!$this->app->routesAreCached()) {
Route::group(['namespace' => 'Laravel\\Spark\\Http\\Controllers'], function ($router) {
require __DIR__ . '/../Http/routes.php';
});
}
}
示例15: auth
public function auth()
{
$namespace = "\\CodePress\\CodeUser\\Controllers";
Route::group(['namespace' => null], function () use($namespace) {
Route::get('login', "{$namespace}\\Auth\\AuthController@showLoginForm");
Route::post('login', "{$namespace}\\Auth\\AuthController@login");
Route::get('logout', "{$namespace}\\Auth\\AuthController@logout");
Route::get('password/reset/{token?}', "{$namespace}\\Auth\\PasswordController@showResetForm");
Route::post('password/email', "{$namespace}\\Auth\\PasswordController@sendResetLinkEmail");
Route::post('password/reset', "{$namespace}\\Auth\\PasswordController@reset");
});
}