상속: implements Illuminate\Contracts\Routing\Registrar, use trait Illuminate\Support\Traits\Macroable
 public function map(Router $router)
 {
     $router->group(['prefix' => 'vendor-girolando', 'namespace' => 'Girolando\\Componentes\\Animal\\Http\\Controllers'], function () use($router) {
         $router->resource('componentes/animal', 'AnimalServiceController', ['only' => ['index']]);
         $router->resource('server/componentes/animal', 'Server\\AnimalServiceController', ['only' => ['index']]);
     });
 }
예제 #2
0
 /**
  * Define the routes for the application.
  *
  * @param \Illuminate\Routing\Router $router
  */
 public function map(Router $router)
 {
     $this->configureAPIRoute();
     $router->group(['namespace' => $this->namespace], function ($router) {
         require app_path('Http/routes.php');
     });
 }
 /**
  * Boot the application events.
  * 
  * @return void
  */
 public function boot(Router $router)
 {
     $router->model('academycycleYear', '\\Modules\\Academycycle\\Entities\\AcademycycleYear');
     $this->registerTranslations();
     $this->registerConfig();
     $this->registerViews();
 }
 /**
  * Define the routes for the application.
  *
  * @param \Illuminate\Routing\Router $router
  *
  * @return void
  */
 public function map(Router $router)
 {
     $router->group(['namespace' => $this->namespace], function (Router $router) {
         /*
          * Admin routes
          */
         $router->get('admin/_locale/{locale}', 'LocaleController@setContentLocale')->name('admin::change-locale');
     });
     /*
      * Api routes
      */
     $router->get('admin/duplicate/{alias}/{resource}', function ($alias, $resource) {
         $repository = app(ucfirst($alias));
         $oldItem = $repository::make()->skip()->find($resource);
         $newItem = $oldItem->replicate();
         if (isset($newItem->system_name)) {
             $newItem->system_name .= ' (copy)';
         }
         unset($newItem->translations);
         unset($newItem->translatedAttributes);
         dd($newItem->getAttributes());
         $newItem = $newItem->create($newItem->getAttributes());
         foreach ($oldItem->translations as $translation) {
             $parent_id = $oldItem->getRelationKey();
             $translation->{$parent_id} = $newItem->id;
             if (isset($translation->title)) {
                 $translation->title .= ' (copy)';
             }
             $translation = $translation->replicate();
             $translation->save();
         }
         return redirect(URL::previous());
     });
 }
 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function map(Router $router)
 {
     $router->group(['namespace' => $this->namespace], function ($router) {
         require app_path('Http/custom_routes.php');
         require app_path('Http/routes.php');
     });
 }
 /**
  * Bind the page route group with group attributes.
  * @param Router $router
  * @param int    $pageId
  * @param string $path
  */
 public function bindPageRouteGroup(Router $router, $pageId, $path)
 {
     $attributes = $this->routeGroupAttributes($path, $pageId);
     $router->group($attributes, function ($router) {
         $this->bindPageRoutes($router);
     });
 }
 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function map(Router $router)
 {
     $router->group(['namespace' => $this->namespace], function ($router) {
         require app_path('Http/Routes/Admin.php');
         require app_path('Http/Routes/Frontend.php');
     });
 }
 /**
  * Define the "web" routes for the application.
  *
  * These routes all receive session state, CSRF protection, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 protected function mapWebRoutes(Router $router)
 {
     //dc($this->namespace);
     $router->group(['namespace' => $this->namespace, 'middleware' => 'web'], function ($router) {
         require app_path('Http/routes_public.php');
     });
 }
예제 #9
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $route = $this->router->current()->methods()[0] . ' /' . $this->router->current()->uri();
     $isPermissionAllRoutes = RoutePermissionModel::getRoutePermissionsRoles('*');
     if ($isPermissionAllRoutes) {
         if (($user = $this->user($request)) === 401) {
             return response()->json(null, 401);
         }
         $hasRole = $user->hasRole($isPermissionAllRoutes->roles, false);
         $hasPerms = $user->can($isPermissionAllRoutes->permissions, false);
         $hasRolePerm = $hasRole || $hasPerms || is_array($isPermissionAllRoutes->roles) && in_array('@', $isPermissionAllRoutes->roles);
         if (!$hasRolePerm) {
             return response()->json(null, 403);
         }
     }
     $routePermission = RoutePermissionModel::getRoutePermissionsRoles($route);
     if ($routePermission) {
         if (($user = $this->user($request)) === 401) {
             return response()->json(null, 401);
         }
         $hasRole = $user->hasRole($routePermission->roles, false);
         $hasPerms = $user->can($routePermission->permissions, false);
         $hasRolePerm = $hasRole || $hasPerms || is_array($routePermission->roles) && in_array('@', $routePermission->roles);
         if (!$hasRolePerm) {
             return response()->json(null, 403);
         }
     }
     return $next($request);
 }
 /**
  * Simplify the process of routes registration
  *
  * @param Router $router
  * @param $name
  */
 protected function makeGroup(Router $router, $name)
 {
     $groupOpts = ['namespace' => $this->namespace . '\\' . studly_case($name), 'prefix' => $name, 'middleware' => ['web']];
     $router->group($groupOpts, function ($router) use($name) {
         require app_path('Http/routes/' . $name . '.php');
     });
 }
예제 #11
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     // Prepare input
     $namespace = $this->getNamespace();
     $path = $this->getPath();
     // Prepare schema fields
     if (!$this->option('no-migration')) {
         $this->generateSchemaMigration();
     }
     // 2. Generate model
     $this->call('apigen:model', ['name' => $this->translator->translate($this->argument('name'))->toModelName(), '--path' => $path, '--namespace' => $namespace]);
     // 3. Generate repository
     $this->call('apigen:repository', ['name' => $this->translator->translate($this->argument('name'))->toModelName(), '--path' => $path, '--namespace' => $namespace]);
     // 4. Generate controller
     if (!$this->option('no-controller')) {
         $this->generateController();
     }
     // 5. Setup API route
     if (!$this->option('no-route') && !$this->option('no-controller')) {
         $resourceName = $this->translator->translate($this->argument('name'))->toTableName();
         $repositoryName = $this->translator->translate($this->argument('name'))->toRepositoryName();
         $routeBaseName = "api.{$resourceName}";
         if ($this->router->getRoutes()->hasNamedRoute("{$routeBaseName}.index")) {
             $this->error("Assuming routes for {$this->translator->translate($this->argument('name'))->toReadableName()} already exists.");
         } else {
             $this->info("Setting up route for '{$repositoryName}' ...");
             $routeString = "\n\nRoute::resource('{$resourceName}', '{$namespace}\\{$repositoryName}\\{$repositoryName}Controller', [ 'names' => [ " . "\n    'index' => '{$routeBaseName}.index', " . "\n    'create' => '{$routeBaseName}.create', " . "\n    'store' => '{$routeBaseName}.store', " . "\n    'show' => '{$routeBaseName}.show', " . "\n    'edit' => '{$routeBaseName}.edit', " . "\n    'update' => '{$routeBaseName}.update', " . "\n    'destroy' => '{$routeBaseName}.destroy', " . "\n] ]);";
             $this->filesystem->append(app_path() . '/routes.php', $routeString);
         }
     }
     // 6. Setup administration interface if needed
     if (!$this->option('no-admin')) {
         $this->setupAdministrationBackend();
     }
 }
예제 #12
0
 /**
  * Define the routes for the application.
  *
  * @param \Illuminate\Routing\Router $router
  *
  * @return void
  */
 public function map(Router $router)
 {
     /* @noinspection PhpUnusedParameterInspection */
     $router->group(['namespace' => $this->namespace], function ($router) {
         require app_path('Http/routes.php');
     });
 }
예제 #13
0
 /**
  * Define the routes for the module.
  *
  * @param \Illuminate\Routing\Router $router
  *
  * @return void
  */
 public function map(Router $router)
 {
     $router->group(['namespace' => $this->namespace, 'middleware' => ['web']], function () {
         /** @noinspection PhpIncludeInspection */
         require config('modules.path') . '/Sales/Http/routes.php';
     });
 }
 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function map(Router $router)
 {
     $router->group(['namespace' => $this->namespace], function ($router) {
         require app_path('Http/Modules/Users/routes.php');
         //require __DIR__.'/../routes.php';
     });
 }
예제 #15
0
 public function testResourceRoute()
 {
     /* @var Dispatcher $dispatcher */
     $dispatcher = $this->getMock(Dispatcher::class);
     $router = new Router($dispatcher, null);
     $routeHelper = new RouteHelper($router);
     $routeHelper->resource('test', 'TestController')->get('get_test', 'get_test')->post('post_test', 'post_test')->put('put_test', 'put_test')->patch('patch_test', 'patch_test')->delete('delete_test', 'delete_test')->rawGet('rawget', 'rawget')->rawPost('rawpost', 'rawpost')->rawPut('rawput', 'rawput')->rawPatch('rawpatch', 'rawpatch')->rawDelete('rawdelete', 'rawdelete')->done();
     $routes = $router->getRoutes();
     $this->assertRoute($routes, 'test', 'GET', 'TestController@index');
     $this->assertRoute($routes, 'test?' . RouteHelper::PAGINATION_URI, 'GET', 'TestController@index');
     $this->assertRoute($routes, 'test', 'POST', 'TestController@store');
     $this->assertRoute($routes, 'test/{test}', 'GET', 'TestController@show');
     $this->assertRoute($routes, 'test/{test}', 'PUT', 'TestController@update');
     $this->assertRoute($routes, 'test/{test}', 'PATCH', 'TestController@update');
     $this->assertRoute($routes, 'test/{test}', 'DELETE', 'TestController@destroy');
     $this->assertRoute($routes, 'test/{test}/get_test', 'GET', 'TestController@get_test');
     $this->assertRoute($routes, 'test/{test}/post_test', 'POST', 'TestController@post_test');
     $this->assertRoute($routes, 'test/{test}/put_test', 'PUT', 'TestController@put_test');
     $this->assertRoute($routes, 'test/{test}/patch_test', 'PATCH', 'TestController@patch_test');
     $this->assertRoute($routes, 'test/{test}/delete_test', 'DELETE', 'TestController@delete_test');
     $this->assertRoute($routes, 'test/rawget', 'GET', 'TestController@rawget');
     $this->assertRoute($routes, 'test/rawpost', 'POST', 'TestController@rawpost');
     $this->assertRoute($routes, 'test/rawput', 'PUT', 'TestController@rawput');
     $this->assertRoute($routes, 'test/rawpatch', 'PATCH', 'TestController@rawpatch');
     $this->assertRoute($routes, 'test/rawdelete', 'DELETE', 'TestController@rawdelete');
 }
 public function map(Router $router)
 {
     $router->group(['prefix' => 'andersonef'], function () use($router) {
         $router->resource('componentes/animal', 'Andersonef\\Componentes\\Animal\\Controllers\\AnimalServiceController', ['only' => ['index']]);
         $router->resource('server/componentes/animal', 'Andersonef\\Componentes\\Animal\\Controllers\\Server\\AnimalServiceController', ['only' => ['index']]);
     });
 }
 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function map(Router $router)
 {
     $attributes = array('namespace' => $this->namespace, 'as' => 'admin::', 'prefix' => 'admin');
     $router->group($attributes, function ($router) {
         require 'routes.php';
     });
 }
 public function boot(Router $router)
 {
     $router->middlewareGroup('api', [\KodiCMS\API\Http\Middleware\VerifyApiToken::class]);
     Auth::viaRequest('token', function ($request) {
         return app(TokenGuard::class)->user($request);
     });
 }
예제 #19
0
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot(Router $router)
 {
     $router->bind('article', function ($id) {
         return \App\Article::where('slug', $id)->first();
     });
     parent::boot($router);
 }
예제 #20
0
 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function map(Router $router)
 {
     $router->group(['namespace' => $this->namespace], function ($router) {
         require app_path('Http/routes.php');
         require app_path('ModuloInventario/Http/routes.php');
     });
 }
예제 #21
0
파일: Application.php 프로젝트: bagwaa/dash
 /**
  * @param Request $request
  * @param int $type
  * @param bool $catch
  * @return mixed
  */
 public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
 {
     // ensure the request is available in the container.
     $this->instance('request', $request);
     // dispatch the request.
     return $this->router->dispatch($this->make('request'));
 }
 private function defineRoutes()
 {
     $this->router->group(['prefix' => '/dashboard/setting', 'namespace' => 'Settings'], function () {
         $this->router->get("/", ['as' => 'setting.index', 'uses' => 'SettingsController@index']);
         $this->router->post("/", ['as' => 'setting.post', 'uses' => 'SettingsController@postSetting']);
     });
 }
 /**
  * Define the "web" routes for the application.
  *
  * These routes all receive session state, CSRF protection, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 protected function mapWebRoutes(Router $router)
 {
     $router->group(['namespace' => $this->namespace, 'middleware' => 'web'], function ($router) {
         require app_path('Http/api_routes.php');
         require app_path('Http/routes.php');
     });
 }
 /**
  * Define the routes for the application.
  *
  * @param Router $router
  */
 public function setupRoutes(Router $router)
 {
     $router->group(['namespace' => 'VilniusTechnology\\SymfonysFacade\\Controllers'], function () {
         require __DIR__ . '/Http/routes.php';
     });
     $this->routeManager->addSymfonyRoutes($router);
 }
예제 #25
0
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot(Router $router)
 {
     // Tell Laravel where the views for a given namespace are located.
     $this->loadViewsFrom(base_path('vendor/aginev/acl/src/resources/views'), 'acl');
     $this->publishes([base_path('vendor/aginev/acl/src/resources/views') => base_path('resources/views/vendor/acl')], 'views');
     // Publish assets
     $this->publishes([base_path('vendor/aginev/acl/src/public') => public_path('vendor/acl')], 'public');
     // Tell Laravel where the translations for a given namespace are located.
     $this->loadTranslationsFrom(base_path('vendor/aginev/acl/src/resources/lang'), 'acl');
     $this->publishes([base_path('vendor/aginev/acl/src/resources/lang') => base_path('resources/lang/vendor/acl')], 'lang');
     // Merge config
     $this->mergeConfigFrom(base_path('vendor/aginev/acl/src/config/acl.php'), 'acl');
     $this->publishes([base_path('vendor/aginev/acl/src/config/acl.php') => config_path('acl.php')], 'config');
     // Publish migrations
     $this->publishes([base_path('vendor/aginev/acl/src/Database/Migrations/') => base_path('/database/migrations')], 'migrations');
     // Publish seeds
     $this->publishes([base_path('vendor/aginev/acl/src/Database/Seeds/') => base_path('/database/seeds')], 'seeds');
     // Define the ACL route middleware
     $router->middleware('acl', 'Aginev\\Acl\\Http\\Middleware\\Acl');
     /**
      * Including A Routes File From A Service Provider
      * NB! Keep this line at the very end of the method to be able to use the config at routes.php
      */
     include base_path('vendor/aginev/acl/src/Http/routes.php');
 }
 /**
  * Map additional routes.
  *
  * @param Router                     $router
  * @param SettingRepositoryInterface $settings
  */
 public function map(Router $router, SettingRepositoryInterface $settings)
 {
     $tag = $settings->value('anomaly.module.posts::tag_segment', 'tag');
     $module = $settings->value('anomaly.module.posts::module_segment', 'posts');
     $category = $settings->value('anomaly.module.posts::category_segment', 'category');
     $permalink = $settings->value('anomaly.module.posts::permalink_structure', ['year', 'month', 'day', 'post']);
     $permalink = implode('}/{', $permalink);
     /**
      * Map the RSS methods.
      */
     $router->any("{$module}/rss/category/{category}.xml", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\RssController@category', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/rss/tag/{tag}.xml", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\RssController@tag', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/rss.xml", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\RssController@recent', 'streams::addon' => 'anomaly.module.posts']);
     /**
      * Map other public routes.
      * Mind the order. Routes are
      * handled first come first serve.
      */
     $router->any("{$module}/{type}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\TypesController@index', 'streams::addon' => 'anomaly.module.posts']);
     $router->any($module, ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\PostsController@index', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/preview/{id}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\PostsController@preview', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/{$tag}/{tag}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\TagsController@index', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/{$category}/{category}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\CategoriesController@index', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/{{$permalink}}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\PostsController@show', 'streams::addon' => 'anomaly.module.posts']);
 }
예제 #27
0
 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function map(Router $router)
 {
     $namespace = $this->namespace;
     $router->group([], function ($router) use($namespace) {
         require realpath(__DIR__ . '/../Http/routes.php');
     });
 }
 /**
  * Map the redirect routes.
  *
  * @param Filesystem  $files
  * @param Application $application
  */
 public function map(Router $router, RedirectRepositoryInterface $redirects)
 {
     /* @var RedirectInterface $redirect */
     foreach ($redirects->all() as $redirect) {
         $router->any($redirect->getFrom(), ['uses' => 'Anomaly\\RedirectsModule\\Http\\Controller\\RedirectsController@handle', 'redirect' => $redirect->getId()]);
     }
 }
예제 #29
0
 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router $router
  *
  * @return void
  */
 public function map(Router $router)
 {
     $router->group(['namespace' => $this->namespace], function ($router) {
         /** @noinspection PhpIncludeInspection */
         require app_path('Http/routes.php');
     });
 }
 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function map(Router $router)
 {
     /* Suppression de "$router" en paramètre qui est non utilisée : Resolve as fixed */
     $router->group(['namespace' => $this->namespace], function () {
         require app_path('Http/routes.php');
     });
 }