本文整理汇总了PHP中Route::any方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::any方法的具体用法?PHP Route::any怎么用?PHP Route::any使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Route
的用法示例。
在下文中一共展示了Route::any方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
public function boot()
{
$this->package('orlissenberg/laravel-zendserver-pushqueue');
// 1. Need a route to marshal requests.
\Route::any("/queue/zendserver", function () {
/** @var ZendJobQueue $connection */
$connection = \Queue::connection("zendjobqueue");
$connection->marshal();
});
// 2. Add the connector to the Queue facade.
\Queue::addConnector("zendserver", function () {
return app()->make("\\Orlissenberg\\Queue\\Connectors\\ZendJobQueueConnector");
});
// 3. Add configuration to the app/config/queue.php
/*
'zendjob' => [
'driver' => 'zendserver',
'options' => [],
'callback-url' => '/queue/zendserver',
],
*/
// 4. Enable the test route (optional for testing only)
/*
\Route::get(
"/queue/zendtest",
function () {
$connection = \Queue::connection("zendjobqueue");
$connection->push("\\Orlissenberg\\Queue\\Handlers\\TestHandler@handle", ["laravel4" => "rocks"]);
return "Job queued.";
}
);
*/
}
示例2: setRoutes
public function setRoutes()
{
$pages = collect(\Config::get('pages'));
foreach ($pages as $page) {
if (!$page['uses']) {
continue;
}
switch ($page['method']) {
case 'get':
\Route::get($this->getUri($page), ['as' => $this->getName($page), 'uses' => $page['uses']]);
break;
case 'post':
\Route::post($this->getUri($page), ['as' => $this->getName($page), 'uses' => $page['uses']]);
break;
case 'patch':
\Route::patch($this->getUri($page), ['as' => $this->getName($page), 'uses' => $page['uses']]);
break;
case 'delete':
\Route::patch($this->getUri($page), ['as' => $this->getName($page), 'uses' => $page['uses']]);
break;
case 'any':
\Route::any($this->getUri($page), ['as' => $this->getName($page), 'uses' => $page['uses']]);
}
}
}
示例3: returnRoutes
public static function returnRoutes()
{
$class = __CLASS__;
Route::group(array('prefix' => 'api'), function () use($class) {
Route::any('debug/{method}', array('uses' => $class . '@debug'));
});
}
示例4: setUp
public function setUp()
{
parent::setUp();
Route::any('{anything}', function () {
})->where('anything', '.*');
$this->app['router']->enableFilters();
}
示例5: init
/**
* Creates a Laravel route, returning a closure which passes the raw input to AngularPHP and returns the response
*/
protected function init()
{
$route = func_get_arg(0);
$this->setErrorHandler(function (\Exception $e, Request $r) {
\Log::error($e, $r->toArray());
});
$endpoint = $this;
\Route::any($route, function () use($endpoint) {
$path = '/' . \Request::path();
$referrer = \Request::header('referer');
$host = \Request::header('host');
if (($origin = \Request::header('Origin')) && count($this->corsHosts)) {
$this->setCorsOrigin($origin);
}
/**
* If being called remotely, add the domain name to the URI
*/
if (strlen($referrer) && parse_url($referrer, PHP_URL_HOST) != $host) {
$uri = '//' . $host . $path;
} else {
$uri = $path;
}
$request = new Request(\Request::json()->all());
$response = $endpoint->setUri($uri)->execute($request, \Request::getMethod());
return \Response::make($response->content, $response->code, $response->headers)->header('Content-Type', $response->contentType);
});
}
示例6: returnRoutes
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'));
});
}
示例7: prepareForTests
/**
* Prepare for the tests to be run.
*/
public function prepareForTests()
{
// Enable your route filters, very important!
\Route::enableFilters();
\Route::any('{all}', 'Tdt\\Core\\BaseController@handleRequest')->where('all', '.*');
\Mail::pretend(true);
}
示例8: boot
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->publishes([__DIR__ . '/../../../config' => config_path('laravalid')], 'config');
$this->publishes([__DIR__ . '/../../../public' => public_path('laravalid')], 'public');
$routeName = \Config::get('laravalid.route');
// remote validations
\Route::any($routeName . '/{rule}', '\\Bllim\\Laravalid\\RuleController@getIndex');
}
示例9: boot
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
\Route::any('plugins', function () {
\Plugin::activate('clients');
echo 'hello';
//print_r(\Plugin::activated());
});
}
示例10: registerRoutes
public static function registerRoutes()
{
$class = get_class();
\Route::get('/pay/{id}/payto.do/{order_no}', ['as' => 'pay.payto', 'uses' => "{$class}@payto"]);
\Route::get('/pay/pay_form_submit.do', ['before' => 'csrf', 'as' => 'pay.form_submit', 'uses' => "{$class}@submit"]);
\Route::any('/pay/{id}/return.do', ['as' => 'pay.return', 'uses' => "{$class}@server_return"]);
\Route::post('/pay/{id}/notify.do', ['as' => 'pay.notify', 'uses' => "{$class}@notify_return"]);
\Route::get('/pay/success/{order_no}', ['as' => 'pay.success', 'uses' => "{$class}@success"]);
\Route::get('/pay/fail/{order_no}', ['as' => 'pay.fail', 'uses' => "{$class}@fail"]);
}
示例11: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
// Zencoder callback uses this to tell our server that it is finished encoding a video
\Route::any('/api/notifications/zencoder', ['uses' => 'Devise\\Media\\Encoding\\ZencoderNotificationsController@store', 'as' => 'dvs-api-notifications-zencoder']);
$apiKey = $this->app['config']->get('devise.zencoder.api-key');
$notifications = $this->app['config']->get('devise.zencoder.notifications');
$encoder = new ZencoderJob($apiKey, $notifications, new FileDownloader(), new Framework());
$this->app->instance("devise.video.encoder", $encoder);
$this->app->instance("devise.audio.encoder", $encoder);
}
示例12: boot
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->publishes([__DIR__ . '/../../../config' => config_path('laravalid')], 'config');
$this->publishes([__DIR__ . '/../../../public' => public_path('laravalid')], 'public');
$routeName = \Config::get('laravalid.route');
// remote validations
\Route::any($routeName . '/{rule}', function ($rule) {
return $this->app['laravalid']->converter()->route()->convert($rule, \Input::all());
});
}
示例13: returnRoutes
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'));
});
}
示例14: boot
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->publishes([__DIR__ . '/../../config/config.php' => config_path('laravalid.php')], 'config');
$this->publishes([__DIR__ . '/../../public' => public_path('laravalid')], 'public');
// remote validations
$routeName = \Config::get('laravalid.route');
$routeAction = \Config::get('laravalid.action', function ($rule) {
$this->app['laravalid']->remoteValidation($rule);
});
\Route::any($routeName . '/{rule}', $routeAction);
}
示例15: returnRoutes
public static function returnRoutes($prefix = null)
{
$class = __CLASS__;
Route::group(array('prefix' => 'kcaptcha'), function () use($class) {
Route::any('form.html', array('as' => 'kcaptcha_form', 'uses' => __CLASS__ . '@getKcaptchaForm'));
Route::any('image.png', array('as' => 'kcaptcha_image', 'uses' => __CLASS__ . '@getKcaptchaImage'));
Route::post('check.json', array('as' => 'kcaptcha_check', 'uses' => __CLASS__ . '@checkKcaptchaImage'));
});
Route::group(array('prefix' => 'captcha'), function () use($class) {
Route::any('form.html', array('as' => 'captcha_form', 'uses' => __CLASS__ . '@getCaptchaForm'));
Route::any('image.png', array('as' => 'captcha_image', 'uses' => __CLASS__ . '@getCaptchaImage'));
Route::post('check.json', array('as' => 'captcha_check', 'uses' => __CLASS__ . '@checkCaptchaImage'));
});
}