当前位置: 首页>>代码示例>>PHP>>正文


PHP Route::resource方法代码示例

本文整理汇总了PHP中Route::resource方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::resource方法的具体用法?PHP Route::resource怎么用?PHP Route::resource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Route的用法示例。


在下文中一共展示了Route::resource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public static function run()
 {
     foreach (glob(app_path() . '/Http/Controllers/*.php') as $filename) {
         $file_parts = explode('/', $filename);
         $file = array_pop($file_parts);
         $file = rtrim($file, '.php');
         if ($file == 'Controller') {
             continue;
         }
         $controllerName = 'App\\Http\\Controllers\\' . $file;
         $controller = new $controllerName();
         if (isset($controller->exclude) && $controller->exclude === true) {
             continue;
         }
         $methods = [];
         $reflector = new \ReflectionClass($controller);
         foreach ($reflector->getMethods(\ReflectionMethod::IS_PUBLIC) as $rMethod) {
             // check whether method is explicitly defined in this class
             if ($rMethod->getDeclaringClass()->getName() == $reflector->getName()) {
                 $methods[] = $rMethod->getName();
             }
         }
         \Route::resource(strtolower(str_replace('Controller', '', $file)), $file, ['only' => $methods]);
     }
 }
开发者ID:avnir,项目名称:easyrouting,代码行数:25,代码来源:Easyrouting.php

示例2: returnRoutes

 public static function returnRoutes()
 {
     $class = __CLASS__;
     Route::group(array('before' => 'auth', 'prefix' => 'admin'), function () use($class) {
         Route::resource('questions', $class, array('except' => array('show'), 'names' => array('index' => 'questions.index', 'create' => 'questions.create', 'store' => 'questions.store', 'edit' => 'questions.edit', 'update' => 'questions.update', 'destroy' => 'questions.destroy')));
     });
 }
开发者ID:Grapheme,项目名称:doktornarabote,代码行数:7,代码来源:questions.controller.php

示例3: returnRoutes

 public static function returnRoutes($prefix = null)
 {
     $class = __CLASS__;
     Route::group(array('before' => 'auth', 'prefix' => $prefix), function () use($class) {
         $entity = $class::$entity;
         Route::resource($class::$group, $class, array('except' => array('show'), 'names' => array('index' => $entity . '.index', 'create' => $entity . '.create', 'store' => $entity . '.store', 'edit' => $entity . '.edit', 'update' => $entity . '.update', 'destroy' => $entity . '.destroy')));
     });
 }
开发者ID:Grapheme,项目名称:amway,代码行数:8,代码来源:admin_news.controller.php

示例4: returnRoutes

 public static function returnRoutes()
 {
     $class = __CLASS__;
     if (Auth::check() && Auth::user()->group_id == 3) {
         Route::group(array('before' => '', 'prefix' => 'admin'), function () use($class) {
             Route::resource('participant-groups', $class, array('except' => array('show'), 'names' => array('index' => 'participant_group.index', 'create' => 'participant_group.create', 'store' => 'participant_group.store', 'edit' => 'participant_group.edit', 'update' => 'participant_group.update', 'destroy' => 'participant_group.destroy')));
         });
     }
 }
开发者ID:Grapheme,项目名称:amway,代码行数:9,代码来源:participant_group.controller.php

示例5: returnRoutes

 public static function returnRoutes($prefix = null)
 {
     $class = __CLASS__;
     Route::group(array('before' => 'auth', 'prefix' => $prefix), function () use($class) {
         #Route::get($class::$group.'/manage', array('uses' => $class.'@getIndex'));
         #Route::controller($class::$group, $class);
         Route::resource('uploads', $class, array('except' => array('show'), 'names' => array('index' => 'uploads.index', 'create' => 'uploads.create', 'store' => 'uploads.store', 'edit' => 'uploads.edit', 'update' => 'uploads.update', 'destroy' => 'uploads.destroy')));
     });
 }
开发者ID:Grapheme,项目名称:dada,代码行数:9,代码来源:admin_uploads.controller.php

示例6: resource

 public static function resource($name, $controller, array $options = [])
 {
     // CRUD routes
     Route::get($name . '/{sortby}/{order}', $controller . '@index');
     Route::get($name . '/orderby{lang}', $controller . '@index');
     Route::get($name . '/{id}/details', $controller . '@showDetailsRow');
     Route::get($name . '/{id}/translate/{lang}', $controller . '@translateItem');
     // Route::delete($name, $controller . '@destroy');
     Route::resource($name, $controller, $options);
 }
开发者ID:ktincheva,项目名称:crud_package,代码行数:10,代码来源:CRUDServiceProvider.php

示例7: setUp

 public function setUp()
 {
     parent::setUp();
     \Route::resource('/test', 'AngieTestController');
     \Route::resource('/test2', 'AngieTest2Controller', array('only' => array('index', 'show', 'post')));
     \Route::get('/test3', 'AngieTestController3@someGetMethod');
     \Route::get('/test/test3', 'AngieTestController3@someShowMethod');
     \Route::put('/test3/{id}/edit', 'AngieTestController3@somePutMethod');
     \Route::get('/test4/{id}/edit', array('prefix' => 'testprefix', 'uses' => 'AngieTestController4@someGetMethod'));
 }
开发者ID:moszkva,项目名称:angie,代码行数:10,代码来源:LaravelRouteParserTest.php

示例8: returnRoutes

 public static function returnRoutes($prefix = null)
 {
     $class = __CLASS__;
     $name = self::$name;
     $group = self::$group;
     Route::group(array('before' => 'auth', 'prefix' => $prefix), function () use($class, $name, $group) {
         #Route::controller($group . '/' . $name, $class);
         Route::get($group . '/' . $name . '/{menu_id}/manage', array('as' => $name . '.manage', 'uses' => $class . '@manage'));
         Route::resource($group . '/' . $name, $class, array('except' => array('show'), 'names' => array('index' => $name . '.index', 'create' => $name . '.create', 'store' => $name . '.store', 'edit' => $name . '.edit', 'update' => $name . '.update', 'destroy' => $name . '.destroy')));
     });
 }
开发者ID:Grapheme,项目名称:amway,代码行数:11,代码来源:admin_menuEditor.controller.php

示例9: boot

 /**
  * Perform post-registration booting of services.
  *
  * @return void
  */
 public function boot()
 {
     $this->loadViewsFrom(__DIR__ . '/views/', 'modelRes');
     $this->publishes([__DIR__ . '/config/model_res.php' => config_path('model_res.php')]);
     $this->mergeConfigFrom(__DIR__ . '/config/model_res.php', 'model_res');
     $paths = config('model_res');
     ModelResorcesController::setPaths($paths);
     foreach ($paths as $key => $value) {
         \Route::resource($key, 'AVIL13\\ModelResorces\\ModelResorcesController');
     }
     return $this;
 }
开发者ID:avil13,项目名称:ModelResorces,代码行数:17,代码来源:ModelResorcesServiceProvider.php

示例10: setUp

 public function setUp()
 {
     parent::setUp();
     $AngieServiceProvider = new AngieServiceProvider($this->app);
     $AngieServiceProvider->boot();
     \Route::resource('/test', 'AngieTestController1');
     \Route::resource('/test2', 'AngieTest2Controller', array('only' => array('index', 'show', 'store')));
     \Route::get('/test3', 'AngieTestController3@someGetMethod');
     \Route::get('/test/test3', 'AngieTestController3@someShowMethod');
     \Route::put('/test3/{id}/edit', 'AngieTestController3@somePutMethod');
     \Route::get('/test4/{id}/edit', 'Test\\Angie\\TestController4@somePutMethod');
     \Route::resource('/test5', 'Test\\Angie\\TestController5');
 }
开发者ID:moszkva,项目名称:angie,代码行数:13,代码来源:GeneratorTest.php

示例11: returnRoutes

 public static function returnRoutes($prefix = null)
 {
     $class = __CLASS__;
     $entity = self::$entity;
     Route::group(array('before' => 'auth', 'prefix' => $prefix . "/" . $class::$group), function () use($class, $entity) {
         Route::post($entity . '/ajax-order-save', array('as' => 'dic.order', 'uses' => $class . "@postAjaxOrderSave"));
         Route::get('dic/{dic_id}/import', array('as' => 'dic.import', 'uses' => $class . '@getImport'));
         Route::post('dic/{dic_id}/import2', array('as' => 'dic.import2', 'uses' => $class . '@postImport2'));
         Route::post('dic/{dic_id}/import3', array('as' => 'dic.import3', 'uses' => $class . '@postImport3'));
         Route::get('dic/{dic_id}/sphinx', array('as' => 'dic.sphinx', 'uses' => $class . '@getSphinx'));
         Route::post('dic/{dic_id}/clear', array('as' => 'dic.clear', 'uses' => $class . '@postClear'));
         Route::resource('dic', $class, array('except' => array('show'), 'names' => array('index' => 'dic.index', 'create' => 'dic.create', 'store' => 'dic.store', 'edit' => 'dic.edit', 'update' => 'dic.update', 'destroy' => 'dic.destroy')));
     });
 }
开发者ID:Grapheme,项目名称:zemaktiv,代码行数:14,代码来源:admin_dics.controller.php

示例12: setUp

 public function setUp()
 {
     parent::setUp();
     View::addLocation(__DIR__ . '/fixtures/views');
     $this->controllerName = "AcProjectsController";
     $this->modelName = "AcProject";
     $this->modelAttributes = ['id' => 5, 'name' => 'Test AuthorityController package', 'priority' => 1];
     $this->resourceName = "ac_projects";
     // str_plural(snake_case($this->modelName));
     Route::resource($this->resourceName, $this->controllerName);
     $this->userAttributes = ['id' => 1, 'username' => 'tortue', 'firstname' => 'Tortue', 'lastname' => 'Torche', 'email' => 'tortue.torche@spam.me', 'password' => Hash::make('tortuetorche'), 'displayname' => 'Tortue Torche'];
     $this->user = $this->getUserWithRole('admin');
     $this->authority = $this->getAuthority($this->user);
     $this->authority->allow('manage', $this->modelName);
 }
开发者ID:efficiently,项目名称:authority-controller,代码行数:15,代码来源:AcProjectsControllerTest.php

示例13: returnRoutes

 public static function returnRoutes($prefix = NULL)
 {
     $class = __CLASS__;
     Route::group(array('before' => 'auth', 'prefix' => $prefix), function () use($class) {
         $entity = $class::$entity;
         Route::get($class::$group . '/{id}/restore', array('as' => $entity . '.restore', 'uses' => $class . "@restore"));
         Route::get($class::$group . '/hierarchy', array('as' => $entity . '.hierarchy', 'uses' => $class . "@getHierarchy"));
         Route::post($class::$group . '/nestedsetmodel', array('as' => $class::$group . '.nestedsetmodel', 'uses' => $class . "@postAjaxNestedSetModel"));
         Route::resource($class::$group, $class, array('except' => array('show'), 'names' => array('index' => $entity . '.index', 'create' => $entity . '.create', 'store' => $entity . '.store', 'edit' => $entity . '.edit', 'update' => $entity . '.update', 'destroy' => $entity . '.destroy')));
     });
     Route::post('ajax-pages-get-page-blocks', $class . '@postAjaxPagesGetPageBlocks');
     Route::post('ajax-pages-get-block', $class . '@postAjaxPagesGetBlock');
     Route::post('ajax-pages-delete-block', $class . '@postAjaxPagesDeleteBlock');
     Route::post('ajax-pages-save-block', $class . '@postAjaxPagesSaveBlock');
 }
开发者ID:Grapheme,项目名称:amway,代码行数:15,代码来源:admin_pages.page.controller.php

示例14: map

 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router $router
  * @return void
  */
 public function map(Router $router, Request $request)
 {
     $locale = $request->segment(1);
     if ($locale == 'localhost') {
         $locale = 'bg';
     }
     $this->app->setLocale($locale);
     $router->group(['namespace' => $this->namespace, 'prefix' => $locale, 'as' => $locale . '.', 'middleware' => 'language'], function ($router) {
         require app_path('Http/routes.php');
         $router->group(['prefix' => 'api/v1', 'as' => 'api.', 'middleware' => 'auth'], function ($router) {
             $router->group(['namespace' => 'Module\\Shop\\APIv1\\Http\\Controller'], function ($router) {
                 \Route::resource('attribute', 'AttributeController');
             });
         });
     });
 }
开发者ID:plamenyankov,项目名称:northstyle,代码行数:22,代码来源:RouteServiceProvider.php

示例15: routes

 public function routes()
 {
     $prefix = Config::get('acl.route_prefix', '');
     \Route::group(['middleware' => ['acl'], 'prefix' => $prefix], function () {
         $permissions = Config::get('acl.routes.permissions', 'acl/permissions');
         $sections = Config::get('acl.routes.sections', 'acl/sections');
         $roles = Config::get('acl.routes.roles', 'acl/roles');
         $users = Config::get('acl.routes.users', 'acl/users');
         $acl = Config::get('acl.routes.index', 'acl');
         \Route::put($roles . '/permission', '\\AldoZumaran\\Acl\\Http\\Controllers\\AclRolesController@permission')->name(\Acl::route('roles', 'read_update', [], false));
         \Route::put($users . '/permission', '\\AldoZumaran\\Acl\\Http\\Controllers\\AclUsersController@permission')->name(\Acl::route('users', 'read_update', [], false));
         \Route::resource($permissions, '\\AldoZumaran\\Acl\\Http\\Controllers\\AclPermissionsController');
         \Route::resource($sections, '\\AldoZumaran\\Acl\\Http\\Controllers\\AclSectionsController');
         \Route::resource($roles, '\\AldoZumaran\\Acl\\Http\\Controllers\\AclRolesController');
         \Route::resource($users, '\\AldoZumaran\\Acl\\Http\\Controllers\\AclUsersController');
         \Route::resource($acl, '\\AldoZumaran\\Acl\\Http\\Controllers\\AclController');
     });
 }
开发者ID:aldozumaran,项目名称:acl,代码行数:18,代码来源:Acl.php


注:本文中的Route::resource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。