本文整理汇总了PHP中Route::controller方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::controller方法的具体用法?PHP Route::controller怎么用?PHP Route::controller使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Route
的用法示例。
在下文中一共展示了Route::controller方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setRoutes
public static function setRoutes($routes)
{
foreach ($routes as $c) {
if (class_exists($c->action)) {
if ($c->route_name == '/') {
$routable = \Route::getInspector()->getRoutable($c->action, '');
} else {
$routable = \Route::getInspector()->getRoutable($c->action, $c->route_name);
}
foreach ($routable as $k => $v) {
if ($v[0]['verb'] == 'get') {
if (isset($v[1])) {
if ($v[1]['plain'] == '') {
\Route::get('/', ['as' => '/', 'uses' => $c->action . '@' . $k]);
} else {
\Route::get($v[1]['plain'], ['as' => $v[1]['plain'], 'uses' => $c->action . '@' . $k]);
}
continue;
}
\Route::get($v[0]['plain'], ['as' => $v[0]['plain'], 'uses' => $c->action . '@' . $k]);
} elseif ($v[0]['verb'] == 'post') {
if (preg_match('/[\\s\\S]+\\/index/', $v[0]['plain'])) {
$v[0]['plain'] = str_replace('/index', '', $v[0]['plain']);
}
\Route::post($v[0]['plain'], ['as' => $v[0]['plain'], 'uses' => $c->action . '@' . $k]);
}
}
if ($c->other_route != '') {
\Route::controller($c->other_route, $c->action);
}
}
}
}
示例2: returnRoutes
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);
});
}
示例3: returnRoutes
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);
});
}
示例4: routes
public function routes()
{
R::group(['namespace' => 'Controllers'], function () {
R::controller('thanks/{ref}', 'Thanks');
R::controller('webhooks', 'Webhooks');
R::controller('other', 'Other');
R::controller('/', 'Root');
});
}
示例5: setMethod
private static function setMethod($need = null)
{
if (is_null($need)) {
return;
}
$method = trim($need, '/');
$arr = explode('@', $method);
self::$method = $arr[1];
self::$controller = $arr[0];
}
示例6: R
/**
* Quickly define a new route.
* A new Route can be defined in two ways:
*
* either by passing all of the route parameters as parameters to R():
* R('','TestController','index','GET');
*
* or by using the methods of the Route class:
* R('')->controller("TestController")->action("index")->on("GET");
*
* (thanks to: Rafael S. Souza <rafael.ssouza [__at__] gmail.com>)
*/
function R($pattern)
{
if (count($args = func_get_args()) == 4) {
$r = new Route($args[0]);
$r->controller($args[1])->action($args[2])->on($args[3]);
return $r;
} else {
return new Route($pattern);
}
}
示例7: handle
public function handle(Route $route)
{
$factory = $this->factory($route->controller());
$controller = $factory->invoke();
$controller->context = $this->httpContext;
$view = $this->view($controller, $this->action($route->action()), $route->parameters());
$view->context = $this->httpContext;
$this->header($view);
$this->render($view);
}
示例8: returnRoutes
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);
});
}
示例9: returnRoutes
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($group . '/' . $name . '/edit/{mod}', $class . '@getEdit');
Route::get($group . '/' . $name . '/save/{mod}', $class . '@postSave');
Route::controller($group . '/' . $name, $class);
});
ModTemplates::addTplDir();
## Site layout dir
}
示例10: R
/**
* Quickly define a new route.
* A new Route can be defined in two ways:
* @package NimblePack
* either by passing all of the route parameters as parameters to R():
* R('','TestController','index','GET');
*
* or by using the methods of the Route class:
* R('')->controller("TestController")->action("index")->on("GET")->short_url('test_index');
*
* (thanks to: Rafael S. Souza <rafael.ssouza [__at__] gmail.com>)
*/
function R()
{
$args = func_get_args();
switch (count($args)) {
case 0:
case 2:
case 3:
throw new NimbleException("Incorrect number of parameters for R()");
case 1:
return new Route($args[0]);
case 4:
$r = new Route($args[0]);
$r->controller($args[1])->action($args[2])->on($args[3]);
return $r;
case 5:
$r = new Route($args[0]);
$r->controller($args[1])->action($args[2])->on($args[3])->short_url($args[4]);
return $r;
}
}
示例11:
<?php
/*
|----------------------------------------------
| App Routes
|----------------------------------------------
*/
Route::controller("welcom", "welcoms");
示例12: function
<?php
Route::group(['prefix' => 'search', 'namespace' => 'Modules\\Search\\Http\\Controllers'], function () {
//Route::get('/', 'SearchController@index');
Route::controller('/', 'SearchController');
});
示例13: function
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
// Création des routes pour le contrôleur implicite SondageController
Route::controller('sondage', 'SondageController');
Route::get('/', function () {
return view('welcome');
});
示例14: function
<?php
Route::group(['namespace' => '\\CMS', 'prefix' => 'cms'], function () {
// ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
// LOGIN
// ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
get('/', ['uses' => 'LoginController@show', 'as' => 'cms.login']);
post('/', ['uses' => 'LoginController@postLogin', 'as' => 'cms.login.post']);
get('/logout', ['uses' => 'LoginController@logout', 'as' => 'cms.logout']);
// ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
// DASHBOARD
// ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
get('/', ['uses' => 'MenuController@index', 'as' => 'cms.menu']);
Route::group(['prefix' => 'dashboard'], function () {
get('/', ['uses' => 'DashboardController@index', 'as' => 'cms.dashboard']);
});
// ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
// NEWS
// ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
Route::controller('news', 'NewsController', ['getIndex' => 'cms.news', 'getCreate' => 'cms.news.create', 'postStore' => 'cms.news.store', 'getEdit' => 'cms.news.edit', 'getUpdate' => 'cms.news.update', 'getShow' => 'cms.news.show', 'putDelete' => 'cms.news.delete']);
// ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
// SETTINGS
// ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
Route::group(['prefix' => 'settings'], function () {
// ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
// WEBSITE
// ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
Route::controller('website', 'WebsiteController', ['getIndex' => 'cms.website', 'getCreate' => 'cms.website.create', 'postStore' => 'cms.website.store', 'getEdit' => 'cms.website.edit', 'getUpdate' => 'cms.website.update', 'getShow' => 'cms.website.show', 'putDelete' => 'cms.website.delete']);
});
});
示例15:
<?php
Route::controller('confirmation', '\\Aamant\\EmailConfirmation\\ConfirmationController');