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'))); }); }
/** * Enable REST routes to expose a resource. * * Example: * <code> * // Create a new '/bucket' route group. * REST::expose('bucket',[ * 'create' => function(){ echo "New bucket"; }, * 'read' => function($id){ echo "SHOW bucket($id)"; }, * 'update' => function($id){ echo "MODIFY bucket($id)"; }, * 'delete' => function($id){ echo "DELETE bucket($id)"; }, * 'list' => function(){ echo "All buckets"; }, * 'clear' => function(){ echo "Cleared all buckets"; }, * ]); * * * * Route::group('/non_conventional_/route/base',function(){ * // Create directly the REST routes (for use inside another parent group). * REST::expose([ * 'create' => function(){ echo "New bucket"; }, * 'read' => function($id){ echo "SHOW bucket($id)"; }, * 'update' => function($id){ echo "MODIFY bucket($id)"; }, * 'delete' => function($id){ echo "DELETE bucket($id)"; }, * 'list' => function(){ echo "All buckets"; }, * 'clear' => function(){ echo "Cleared all buckets"; }, * ]); * }); * * </code> * * @param string $element The resource name. * @param array $maps A map of actions callbacks for different CRUD actions. */ public static function expose($element, array $maps = null) { if (null === $maps && is_array($element)) { $maps = $element; $collection = ''; } else { $collection = '/' . $element; } return Route::group($collection, function () use($maps) { $actions = []; if (isset($maps['list'])) { $actions['get'] = $maps['list']; } if (isset($maps['create'])) { $actions['post'] = $maps['create']; } if (isset($maps['clear'])) { $actions['delete'] = $maps['clear']; } Route::map('/', $actions); $actions = []; if (isset($maps['read'])) { $actions['get'] = $maps['read']; } if (isset($maps['update'])) { $actions['put'] = $maps['update']; } if (isset($maps['delete'])) { $actions['delete'] = $maps['delete']; } Route::map("/:id", $actions); }); }
public static function returnRoutes($prefix = null) { $dics_for_cache = ['projects', 'types']; foreach ($dics_for_cache as $dic_name) { ## Refresh dics cache #Cache::forget('dic_' . $dic_name); $dic_[$dic_name] = Cache::get('dic_' . $dic_name); if (!$dic_[$dic_name]) { Cache::forget('dic_' . $dic_name); $dic_[$dic_name] = Dic::valuesBySlug($dic_name, function ($query) { $query->orderBy('lft', 'ASC'); }, ['allfields', 'alltextfields'], true, true, true); #Helper::d($dic_name); Helper::ta($dic_{$dic_name}); #die; $dic_[$dic_name] = DicLib::loadImages($dic_[$dic_name], ['avatar', 'image', 'logo', 'photo', 'header_img']); #Helper::d($dic_name); Helper::ta($dic_{$dic_name}); #die; Cache::add('dic_' . $dic_name, $dic_[$dic_name], self::$global_cache_min); } View::share('dic_' . $dic_name, $dic_[$dic_name]); #Helper::d($dic_name); Helper::ta($dic_{$dic_name}); } #Helper::tad($dic_{'city'}); #die; Route::group(array('prefix' => '{lang}'), function () { Route::any('/project/{slug}', array('as' => 'app.project', 'uses' => __CLASS__ . '@appProject')); #Route::any('/ajax/send-message', array('as' => 'ajax.send-message', 'uses' => __CLASS__.'@postSendMessage')); #Route::any('/ajax/some-action', array('as' => 'ajax.some-action', 'uses' => __CLASS__.'@postSomeAction')); }); Route::group(array(), function () { #Route::any('/ajax/send-message', array('as' => 'ajax.send-message', 'uses' => __CLASS__.'@postSendMessage')); #Route::any('/ajax/some-action', array('as' => 'ajax.some-action', 'uses' => __CLASS__.'@postSomeAction')); }); }
public static function returnRoutes() { $class = __CLASS__; Route::group(array('prefix' => 'api'), function () use($class) { Route::any('debug/{method}', array('uses' => $class . '@debug')); }); }
public static function returnRoutes() { $class = __CLASS__; Route::group(array('before' => 'guest', 'prefix' => ''), function () use($class) { Route::post('social-signin', array('as' => 'signin.ulogin', 'uses' => $class . '@postUlogin')); }); }
function routes($config) { // only mess with the cms Route::group(['prefix' => $config['cms_path'], 'middleware' => ['cms.language', 'cms.view']], function () use($config) { Route::group(['namespace' => '\\Thorazine\\Cms\\Http\\Controllers'], function () use($config) { // pickup on first contact Route::get('/', ['as' => 'cms.auth.first', 'uses' => 'AuthController@first']); Route::post('/', ['as' => 'cms.auth.first.create', 'uses' => 'AuthController@create']); // auth Route::post('/login/submit', ['as' => 'cms.auth.check', 'before' => 'csrf', 'uses' => 'AuthController@check']); Route::get('/login', ['as' => 'cms.auth.login', 'uses' => 'AuthController@index']); // All routes that do require auth Route::group(['middleware' => ['cms.auth']], function () use($config) { // logout Route::get('/logout', ['as' => 'cms.auth.logout', 'uses' => 'AuthController@destroy']); // cms home Route::get('/base', ['as' => 'cms.base', 'uses' => 'CmsController@index']); // flexible auth routes Route::group(['middleware' => ['cms.model']], function () use($config) { // flexible restfull routes Route::get('/{module}/{model}/index', ['as' => 'module.model.index', 'uses' => 'PreController@index']); Route::get('/{module}/{model}/create', ['as' => 'module.model.create', 'uses' => 'PreController@create']); Route::post('/{module}/{model}/store', ['as' => 'module.model.store', 'uses' => 'PreController@store']); Route::get('/{module}/{model}/show/{id}', ['as' => 'module.model.show', 'uses' => 'PreController@show']); Route::get('/{module}/{model}/edit/{id}', ['as' => 'module.model.edit', 'uses' => 'PreController@edit']); Route::put('/{module}/{model}/update/{id}', ['as' => 'module.model.update', 'uses' => 'PreController@update']); Route::delete('/{module}/{model}/destroy/{id}', ['as' => 'module.model.destroy', 'uses' => 'PreController@destroy']); Route::post('/{module}/{model}/order', ['as' => 'module.model.order', 'uses' => 'PreController@order']); Route::get('/{module}/{model}/{action}', ['as' => 'module.model.action', 'uses' => 'PreController@custom']); }); }); }); }); }
/** * Bootstrap the application events. * * @return void */ public function boot() { $this->package('kkstudio/blog'); \Route::get('blog', '\\Kkstudio\\Blog\\Controllers\\BlogController@index'); \Route::get('blog/category/{slug}', '\\Kkstudio\\Blog\\Controllers\\BlogController@fromCategory'); \Route::get('blog/{slug}', '\\Kkstudio\\Blog\\Controllers\\BlogController@show'); \Route::group(['prefix' => 'admin', 'before' => 'admin'], function () { \Route::get('blog', '\\Kkstudio\\Blog\\Controllers\\BlogController@admin'); \Route::get('blog/create', '\\Kkstudio\\Blog\\Controllers\\BlogController@create'); \Route::post('blog/create', '\\Kkstudio\\Blog\\Controllers\\BlogController@postCreate'); \Route::get('blog/{slug}/edit', '\\Kkstudio\\Blog\\Controllers\\BlogController@edit'); \Route::post('blog/{slug}/edit', '\\Kkstudio\\Blog\\Controllers\\BlogController@postEdit'); \Route::get('blog/{slug}/delete', '\\Kkstudio\\Blog\\Controllers\\BlogController@delete'); \Route::post('blog/{slug}/delete', '\\Kkstudio\\Blog\\Controllers\\BlogController@postDelete'); // Categories \Route::get('blog/categories', '\\Kkstudio\\Blog\\Controllers\\BlogController@categories'); \Route::get('blog/categories/create', '\\Kkstudio\\Blog\\Controllers\\BlogController@category_create'); \Route::post('blog/categories/create', '\\Kkstudio\\Blog\\Controllers\\BlogController@category_postCreate'); \Route::get('blog/categories/{slug}/edit', '\\Kkstudio\\Blog\\Controllers\\BlogController@category_edit'); \Route::post('blog/categories/{slug}/edit', '\\Kkstudio\\Blog\\Controllers\\BlogController@category_postEdit'); \Route::get('blog/categories/{slug}/delete', '\\Kkstudio\\Blog\\Controllers\\BlogController@category_delete'); \Route::post('blog/categories/{slug}/delete', '\\Kkstudio\\Blog\\Controllers\\BlogController@category_postDelete'); \Route::post('blog/categories/swap', '\\Kkstudio\\Blog\\Controllers\\BlogController@category_swap'); }); }
/** * 初始化应用 */ public static function init() { //加载应用组配置 if (IS_GROUP) { is_file(COMMON_CONFIG_PATH . 'config.php') and C(require COMMON_CONFIG_PATH . 'config.php'); is_file(COMMON_CONFIG_PATH . 'event.php') and C('GROUP_EVENT', require COMMON_CONFIG_PATH . 'event.php'); is_file(COMMON_CONFIG_PATH . 'alias.php') and alias_import(COMMON_CONFIG_PATH . 'alias.php'); is_file(COMMON_LANGUAGE_PATH . C('LANGUAGE') . '.php') and L(require COMMON_LANGUAGE_PATH . C('LANGUAGE') . '.php'); } IS_GROUP and Route::group(); defined('GROUP_NAME') or define('GROUP_NAME', isset($_GET[C('VAR_GROUP')]) && !empty($_GET[C('VAR_GROUP')]) ? $_GET[C('VAR_GROUP')] : C('DEFAULT_GROUP')); defined('APP') or define('APP', ucfirst(IS_GROUP ? $_GET[C('VAR_APP')] : basename(substr(APP_PATH, 0, -1)))); IS_GROUP and define('APP_PATH', GROUP_PATH . GROUP_NAME . '/' . APP . '/'); //常量 defined('CONTROL_PATH') or define('CONTROL_PATH', APP_PATH . 'Control/'); defined('MODEL_PATH') or define('MODEL_PATH', APP_PATH . 'Model/'); defined('CONFIG_PATH') or define('CONFIG_PATH', APP_PATH . 'Config/'); defined('EVENT_PATH') or define('EVENT_PATH', APP_PATH . 'Event/'); defined('LANGUAGE_PATH') or define('LANGUAGE_PATH', APP_PATH . 'Language/'); defined('TAG_PATH') or define('TAG_PATH', APP_PATH . 'Tag/'); defined('LIB_PATH') or define('LIB_PATH', APP_PATH . 'Lib/'); defined('COMPILE_PATH') or define('COMPILE_PATH', TEMP_PATH . (IS_GROUP ? GROUP_NAME . '/' . APP . '/Compile/' : 'Compile/')); defined('CACHE_PATH') or define('CACHE_PATH', TEMP_PATH . (IS_GROUP ? GROUP_NAME . '/' . APP . '/Cache/' : 'Cache/')); defined('TABLE_PATH') or define('TABLE_PATH', TEMP_PATH . (IS_GROUP ? GROUP_NAME . '/' . APP . '/Table/' : 'Table/')); defined('LOG_PATH') or define('LOG_PATH', TEMP_PATH . 'Log/'); //应用配置 is_file(CONFIG_PATH . 'config.php') and C(require CONFIG_PATH . 'config.php'); is_file(CONFIG_PATH . 'event.php') and C('APP_EVENT', require CONFIG_PATH . 'event.php'); is_file(CONFIG_PATH . 'alias.php') and alias_import(CONFIG_PATH . 'alias.php'); is_file(LANGUAGE_PATH . C('LANGUAGE') . '.php') and L(require LANGUAGE_PATH . C('LANGUAGE') . '.php'); //模板目录 $tpl_style = C('TPL_STYLE'); if ($tpl_style and substr($tpl_style, -1) != '/') { $tpl_style .= '/'; } defined('TPL_PATH') or define('TPL_PATH', (C('TPL_PATH') ? C('TPL_PATH') : APP_PATH . 'Tpl/') . $tpl_style); defined('PUBLIC_PATH') or define('PUBLIC_PATH', TPL_PATH . 'Public/'); //应用url解析并创建常量 Route::app(); //=========================环境配置 date_default_timezone_set(C('DEFAULT_TIME_ZONE')); @ini_set('memory_limit', '128M'); @ini_set('register_globals', 'off'); @ini_set('magic_quotes_runtime', 0); define('NOW', $_SERVER['REQUEST_TIME']); define('NOW_MICROTIME', microtime(true)); define('REQUEST_METHOD', $_SERVER['REQUEST_METHOD']); define('IS_GET', REQUEST_METHOD == 'GET' ? true : false); define('IS_POST', REQUEST_METHOD == 'POST' ? true : false); define('IS_PUT', REQUEST_METHOD == 'PUT' ? true : false); define('IS_AJAX', ajax_request()); define('IS_DELETE', REQUEST_METHOD == 'DELETE' ? true : false); define('HTTP_REFERER', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null); //注册自动载入函数 spl_autoload_register(array(__CLASS__, 'autoload')); set_error_handler(array(__CLASS__, 'error'), E_ALL); set_exception_handler(array(__CLASS__, 'exception')); register_shutdown_function(array(__CLASS__, 'fatalError')); HDPHP::_appAutoLoad(); }
/** * Bootstrap the application events. * * @return void */ public function boot() { $this->package('kkstudio/info'); \Route::group(['before' => 'admin'], function () { \Route::get('admin/info', '\\Kkstudio\\Info\\Controllers\\InfoController@admin'); \Route::post('admin/info', '\\Kkstudio\\Info\\Controllers\\InfoController@edit'); }); }
protected function createRouteAdmin() { Route::group(['middleware' => ['web', 'auth']], function () { Route::get('/admin/test', function () { return 'Admin Test!'; }); }); }
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'))); }); }
protected function createRoute() { Route::group(['middleware' => ['web']], function () { Route::get('/email/registration', function () { return view('email.registration', ['username' => '*****@*****.**', 'password' => '123456']); }); }); }
/** * Load Easel specific routes. */ private function defineRoutes() { if (!$this->app->routesAreCached()) { \Route::group(['namespace' => 'Easel\\Http\\Controllers'], function ($router) { require EASEL_BASE_PATH . '/src/Http/routes.php'; }); } }
public function createApplication() { $app = parent::createApplication(); Route::group(['namespace' => 'AblaFahita\\Http\\Controllers'], function () { require app_path() . '/Http/routes/api.php'; }); return $app; }
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'))); }); } }
public function routes() { R::group(['namespace' => 'Controllers'], function () { R::controller('thanks/{ref}', 'Thanks'); R::controller('webhooks', 'Webhooks'); R::controller('other', 'Other'); R::controller('/', 'Root'); }); }
public static function returnRoutes($prefix = null) { $class = __CLASS__; $name = self::$name; $group = self::$group; Route::group(array('before' => 'auth', 'prefix' => 'admin'), function () use($class, $name, $group) { Route::get('collector-js', array('as' => 'collector-js', 'uses' => $class . '@getCollectorScripts')); }); }
public static function returnRoutes() { $class = __CLASS__; Route::group(array('before' => 'user.auth', 'prefix' => 'participant'), function () use($class) { Route::get('profile', array('as' => 'profile.edit', 'uses' => $class . '@profileEdit')); Route::get('tell-story', array('as' => 'profile.tell-story', 'uses' => $class . '@tellStory')); Route::post('profile', array('as' => 'profile.save', 'uses' => $class . '@profileSave')); }); }
public static function returnRoutes($prefix = null) { #/* $class = __CLASS__; Route::group(array('before' => 'auth', 'prefix' => $prefix), function () use($class) { Route::get($class::$group . '/phpinfo', array('as' => 'system.phpinfo', 'uses' => $class . '@getPhpInfo')); }); #*/ }
public static function returnRoutes($prefix = null) { $class = __CLASS__; Route::post('admin/gallery/ajax-order-save', array('as' => 'gallery.order', 'uses' => $class . "@postAjaxOrderSave")); Route::group(array('before' => 'auth', 'prefix' => $prefix), function () use($class) { Route::get($class::$group . '/manage', array('uses' => $class . '@getIndex')); Route::controller($class::$group, $class); }); }
protected function createRoute($methodAnnot, $refMethod) { $group = !is_null($this->classAnnotation) ? $this->classAnnotation->group : []; \Route::group($group, function () use($methodAnnot, $refMethod) { $method = $methodAnnot->method; $action = ['uses' => $refMethod->class . '@' . $refMethod->name, 'before' => $methodAnnot->before, 'after' => $methodAnnot->after, 'as' => $methodAnnot->name]; \Route::$method($methodAnnot->path, $action)->where($methodAnnot->where); }); }
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'))); }); }
public static function returnRoutes($prefix = null) { $class = __CLASS__; $name = self::$name; $group = self::$group; Route::group(array('before' => 'auth', 'prefix' => 'admin'), function () use($class, $name, $group) { Route::controller($group . '/' . $name, $class); }); }
public static function init() { if (IS_GROUP) { if (is_file(COMMON_PATH . 'Config/config.php')) { C(require COMMON_PATH . 'Config/config.php'); } Route::group(); } define("APP", ucfirst(IS_GROUP ? $_GET[C('VAR_APP')] : basename(substr(APP_PATH, 0, -1)))); IS_GROUP and define("APP_PATH", GROUP_PATH . 'App/' . APP . '/'); defined("CONTROL_PATH") or define("CONTROL_PATH", APP_PATH . 'Control/'); defined("MODEL_PATH") or define("MODEL_PATH", APP_PATH . 'Model/'); defined("CONFIG_PATH") or define("CONFIG_PATH", APP_PATH . 'Config/'); defined("EXTEND_PATH") or define("EXTEND_PATH", APP_PATH . 'Extend/'); defined("EVENT_PATH") or define("EVENT_PATH", EXTEND_PATH . 'Event/'); defined("LANGUAGE_PATH") or define("LANGUAGE_PATH", EXTEND_PATH . 'Language/'); defined("TAG_PATH") or define("TAG_PATH", EXTEND_PATH . 'Tag/'); defined("LIB_PATH") or define("LIB_PATH", EXTEND_PATH . 'Lib/'); defined("COMPILE_PATH") or define("COMPILE_PATH", TEMP_PATH . (IS_GROUP ? APP . '/Compile/' : 'Compile/')); defined("CACHE_PATH") or define("CACHE_PATH", TEMP_PATH . (IS_GROUP ? APP . '/Cache/' : 'Cache/')); defined("TABLE_PATH") or define("TABLE_PATH", TEMP_PATH . (IS_GROUP ? APP . '/Table/' : 'Table/')); defined("LOG_PATH") or define("LOG_PATH", TEMP_PATH . 'Log/'); $app_config = CONFIG_PATH . 'config.php'; if (is_file($app_config)) { C(require $app_config); } $tpl = rtrim(C("TPL_DIR"), '/'); $tpl_style = rtrim(C("TPL_STYLE"), '/'); define("TPL_PATH", (strstr($tpl, '/') ? $tpl . '/' : APP_PATH . $tpl . '/') . ($tpl_style ? $tpl_style . '/' : $tpl_style)); define("PUBLIC_PATH", TPL_PATH . 'Public/'); Route::app(); @ini_set('memory_limit', '128M'); @ini_set("register_globals", "off"); @ini_set('magic_quotes_runtime', 0); define('NOW', $_SERVER['REQUEST_TIME']); define("NOW_MICROTIME", microtime(true)); define("MAGIC_QUOTES_GPC", @get_magic_quotes_gpc() ? true : false); define('REQUEST_METHOD', $_SERVER['REQUEST_METHOD']); define('IS_GET', REQUEST_METHOD == 'GET' ? true : false); define('IS_POST', REQUEST_METHOD == 'POST' ? true : false); define('IS_PUT', REQUEST_METHOD == 'PUT' ? true : false); define("IS_AJAX", ajax_request()); define('IS_DELETE', REQUEST_METHOD == 'DELETE' ? true : false); spl_autoload_register(array(__CLASS__, "autoload")); set_error_handler(array(__CLASS__, "error"), E_ALL); set_exception_handler(array(__CLASS__, "exception")); O("Session" . ucwords(C("SESSION_ENGINE")), "run"); !ini_get("session.auto_start") and C("SESSION_AUTO") and session_start(); is_file(COMMON_LANGUAGE_PATH . C('LANGUAGE') . '.php') and L(require COMMON_LANGUAGE_PATH . C('LANGUAGE') . '.php'); is_file(LANGUAGE_PATH . C('LANGUAGE') . '.php') and L(require LANGUAGE_PATH . C('LANGUAGE') . '.php'); C("CORE_EVENT", require HDPHP_CONFIG_PATH . "event.php"); IS_GROUP and is_file(COMMON_CONFIG_PATH . 'event.php') and C("GROUP_EVENT", require COMMON_CONFIG_PATH . 'event.php'); is_file(CONFIG_PATH . 'event.php') and C("APP_EVENT", require CONFIG_PATH . 'event.php'); IS_GROUP and is_file(COMMON_LIB_PATH . 'Alias.php') and alias_import(COMMON_LIB_PATH . 'Alias.php'); is_file(LIB_PATH . 'Alias.php') and alias_import(LIB_PATH . 'Alias.php'); }
public static function returnRoutes() { $class = __CLASS__; Route::group(array('prefix' => 'api'), function () use($class) { Route::get('help', array('uses' => $class . '@help')); Route::get('help/{method}', array('uses' => $class . '@helpMethod')); Route::any('register', array('uses' => $class . '@register')); Route::any('questions', array('uses' => $class . '@getQuestions')); Route::any('finish', array('uses' => $class . '@setRightAnswers')); }); }
public static function returnRoutes($prefix = null) { $class = __CLASS__; $name = self::$name; $group = self::$group; Route::group(array('before' => 'auth', 'prefix' => 'admin'), function () use($class, $name, $group) { Route::post($group . '/' . $name, array('as' => 'modules.change', 'uses' => $class . '@postModule')); Route::post($name . '/ajax-order-save', array('as' => 'modules.order', 'uses' => $class . "@postAjaxOrderSave")); Route::controller($group . '/' . $name, $class); }); }
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'))); }); }
public static function returnRoutes() { $class = __CLASS__; Route::group(array('before' => 'user.auth', 'prefix' => 'promo'), function () use($class) { Route::post('/first/register', array('as' => 'promo.first.register', 'uses' => $class . '@firstRegister')); Route::post('/second/register', array('as' => 'promo.second.register', 'uses' => $class . '@secondRegister')); Route::post('/second/register/certificates', array('as' => 'promo.second.register.certificates', 'uses' => $class . '@secondRegisterCertificates')); Route::post('/third/register', array('before' => 'csrf', 'as' => 'promo.third.register', 'uses' => $class . '@thirdRegister')); }); Route::get('/participant/{url}', array('as' => 'show.participant.writing', 'uses' => $class . '@showWriting')); }
public static function returnRoutes() { $class = __CLASS__; Route::group(array('before' => 'user.auth', 'prefix' => 'participant'), function () use($class) { Route::get('profile', array('as' => 'profile.edit', 'uses' => $class . '@profileEdit')); Route::post('profile', array('as' => 'profile.save', 'uses' => $class . '@profileSave')); Route::post('profile/video/upload', array('as' => 'profile.video.upload', 'uses' => $class . '@profileVideoUpdate')); }); Route::post('video/youtube', array('as' => 'profile.video.youtube', 'uses' => $class . '@setYoutubeVideo')); Route::get('video/youtube', array('as' => 'profile.video.youtube', 'uses' => $class . '@getYoutubeVideo')); Route::post('participant/{user_id}/set-like', array('as' => 'participant.public.set.like', 'uses' => $class . '@setLike')); }
protected function createRoute($methodAnnot, $refMethod) { $group = !is_null($this->classAnnotation) ? $this->classAnnotation->group : []; \Route::group($group, function () use($methodAnnot, $refMethod) { $method = $methodAnnot->method; $action = ['uses' => $refMethod->class . '@' . $refMethod->name, 'middleware' => $methodAnnot->middleware, 'as' => $methodAnnot->name]; if ($methodAnnot->middleware == null) { unset($action['middleware']); } \Route::$method($methodAnnot->path, $action)->where($methodAnnot->where); }); }