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


PHP Route::options方法代码示例

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


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

示例1: function

});
/*
|----------------------------------------------------------------------
| oAuth handling
|----------------------------------------------------------------------
*/
Route::post('oauth/access_token', function () {
    $bridgedRequest = OAuth2\HttpFoundationBridge\Request::createFromRequest(Request::instance());
    $bridgedResponse = new OAuth2\HttpFoundationBridge\Response();
    $bridgedResponse = App::make('oauth2')->handleTokenRequest($bridgedRequest, $bridgedResponse);
    return $bridgedResponse;
});
//Add OPTIONS routes for all defined xAPI and api routes
foreach (Route::getRoutes()->getIterator() as $route) {
    if ($route->getPrefix() === 'data/xAPI' || $route->getPrefix() === 'api/v1') {
        Route::options($route->getUri(), 'Controllers\\API\\Base@CORSOptions');
    }
}
/*
|------------------------------------------------------------------
| For routes that don't exist
|------------------------------------------------------------------
*/
App::missing(function ($exception) {
    if (Request::segment(1) == "data" || Request::segment(1) == "api") {
        $error = array('error' => true, 'message' => $exception->getMessage(), 'code' => $exception->getStatusCode());
        return Response::json($error, $exception->getStatusCode());
    } else {
        return Response::view('errors.missing', array('message' => $exception->getMessage()), 404);
    }
});
开发者ID:utkarshx,项目名称:learninglocker,代码行数:31,代码来源:routes.php

示例2: array

    Route::get('activities', array('uses' => 'Controllers\\xAPI\\ActivityController@full'));
    //State API
    Route::get('activities/state', array('uses' => 'Controllers\\xAPI\\StateController@index'));
    Route::put('activities/state', array('uses' => 'Controllers\\xAPI\\StateController@store'));
    Route::post('activities/state', array('uses' => 'Controllers\\xAPI\\StateController@store'));
    Route::delete('activities/state', array('uses' => 'Controllers\\xAPI\\StateController@delete'));
    Route::any('activities/state', array('uses' => 'Controllers\\xAPI\\StateController@index'));
});
/*
|------------------------------------------------------------------
| Learning Locker RESTful API
|------------------------------------------------------------------
*/
Route::group(array('prefix' => 'api/v1', 'before' => 'auth.statement'), function () {
    Config::set('api.using_version', 'v1');
    Route::options('/{extra}', 'Controllers\\API\\BaseController@CORSOptions')->where('extra', '(.*)');
    Route::get('/', function () {
        return Response::json(array('version' => Config::get('api.using_version')));
    });
    Route::get('query/analytics', array('uses' => 'Controllers\\API\\AnalyticsController@index'));
    Route::get('query/statements', array('uses' => 'Controllers\\API\\StatementController@index'));
    Route::get('query/{section}', array('uses' => 'Controllers\\API\\AnalyticsController@getSection'));
    Route::get('exports/{export_id}/show', array('uses' => 'Controllers\\API\\ExportingController@show'));
    Route::get('exports/{export_id}/show/csv', array('uses' => 'Controllers\\API\\ExportingController@showCSV'));
    Route::get('exports', array('uses' => 'Controllers\\API\\ExportingController@getAll'));
    Route::get('exports/{export_id}', array('uses' => 'Controllers\\API\\ExportingController@get'));
    Route::post('exports', array('uses' => 'Controllers\\API\\ExportingController@create'));
    Route::put('exports/{export_id}', array('uses' => 'Controllers\\API\\ExportingController@update'));
    Route::delete('exports/{export_id}', array('uses' => 'Controllers\\API\\ExportingController@destroy'));
    Route::get('reports', array('uses' => 'Controllers\\API\\ReportController@getAll'));
    Route::resource('site', 'Controllers\\API\\SiteController');
开发者ID:jesposito,项目名称:learninglocker,代码行数:31,代码来源:routes.php

示例3: array

//optional parameters
// routes/page/{name?}  with ?
//database
Route::get('database', 'databaseController@index');
//session
Route::get('sessions', 'sessionsController@index');
Route::post('sessions', 'sessionsController@process');
Route::get('testarray', array('as' => 'testing', 'uses' => 'sessionsController@index'));
Route::get('fntest', function () {
    return 'this is function test';
});
Route::post('routes/page/post', 'routesController@index');
Route::put('routes/page/put', 'routesController@index');
Route::patch('routes/page/patch', 'routesController@index');
Route::delete('routes/page/delete', 'routesController@index');
Route::options('routes/page/options', 'routesController@index');
Route::any('routes/page/any', 'routesController@index');
Route::match(['get', 'post'], 'routes/page/match', 'routesController@index');
//
Route::group(['middleware' => 'auth'], function () {
    Route::get('routes/page/ingroup1', 'routesController@index');
});
Route::group(['prefix' => 'users'], function () {
    Route::get('routes/page/pfxusers', 'routesController@index');
});
Route::group(['namespace' => 'testns'], function () {
    Route::get('routes/page/testns', 'routesController@index');
});
Route::group(['middleware' => 'auth'], function () {
    Route::group(['prefix' => 'admin'], function () {
        Route::get('routes/page/admin', 'routesController@index');
开发者ID:TomazKovacic,项目名称:ox,代码行数:31,代码来源:routes.php

示例4: function

<?php

Route::group(['prefix' => 'companies'], function () {
    Route::get('/', 'CompanyController@index');
    Route::get('/{id}', 'CompanyController@show');
    Route::post('/', 'CompanyController@store');
    Route::put('/{id}', 'CompanyController@update');
    Route::delete('/{id}', 'CompanyController@destroy');
    // options
    Route::options('/', 'CompanyController@options');
    Route::options('/{id}', 'CompanyController@optionsDetails');
});
Route::group(['prefix' => 'employees'], function () {
    Route::get('/', 'EmployeeController@index');
});
开发者ID:ItsRD,项目名称:Restful,代码行数:15,代码来源:routes.php

示例5: array

     Route::get('shows', array("uses" => $p . 'api\\v1\\ApiController@getShows'));
     Route::get('playlists/{id}/mediaItems/{id2}', array("uses" => $p . 'api\\v1\\ApiController@getPlaylistMediaItem'));
     Route::get('playlists/{id}/mediaItems', array("uses" => $p . 'api\\v1\\ApiController@getPlaylistMediaItems'));
     Route::get('playlists/{id}', array("uses" => $p . 'api\\v1\\ApiController@getPlaylist'));
     Route::get('playlists', array("uses" => $p . 'api\\v1\\ApiController@getPlaylists'));
     Route::get('mediaItems/{id}/playlists', array("uses" => $p . 'api\\v1\\ApiController@getMediaItemPlaylists'));
     Route::get('mediaItems/{id}', array("uses" => $p . 'api\\v1\\ApiController@getMediaItem'));
     Route::get('mediaItems', array("uses" => $p . 'api\\v1\\ApiController@getMediaItems'));
     Route::post('webhook/configure', array("uses" => $p . 'api\\v1\\ApiWebhookController@postConfigure'));
     Route::post('webhook/test', array("uses" => $p . 'api\\v1\\ApiWebhookController@postTest'));
     // handle requests with OPTIONS method
     Route::options('{catchAll}', function () {
         $response = Response::make("", 204);
         // 204 = No Content
         $response->header("Access-Control-Allow-Origin", "*");
         $response->header("Access-Control-Allow-Methods", "OPTIONS, GET");
         $response->header("Access-Control-Max-Age", 300);
         // cache preflight request for 5 mins
         $response->header("Access-Control-Allow-Headers", "X-Api-Key");
         return $response;
     });
     // show a json 404
     Route::any('{catchAll}', array("uses" => $p . 'api\\v1\\ApiController@respondNotFound'));
 });
 Route::group(array('before' => 'csrf'), function () use(&$p) {
     // ADMIN
     Route::controller('/admin/login', $p . 'home\\admin\\login\\LoginController');
     Route::controller('/admin/upload', $p . 'home\\admin\\upload\\UploadController');
     Route::group(array('before' => 'auth'), function () use(&$p) {
         Route::controller('/admin/dashboard', $p . 'home\\admin\\dashboard\\DashboardController');
         Route::controller('/admin/media', $p . 'home\\admin\\media\\MediaController');
         Route::controller('/admin/shows', $p . 'home\\admin\\shows\\ShowsController');
开发者ID:joshhodgson,项目名称:Website,代码行数:32,代码来源:routes.php

示例6: function

    if (Auth::attempt(['email' => $email, 'password' => $password])) {
        $user = Auth::user();
        return Response::json($user->toApiArray(), 200, [], JSON_NUMERIC_CHECK);
    } else {
        return Response::json(['error' => 'Invalid email or password.'], 403);
    }
});
Route::post('/api/auth/logout', function () {
    if (Auth::check()) {
        Auth::logout();
        return Response::json([]);
    }
    return Response::json(['error' => 'Not logged in.'], 403);
});
Route::options('/api/{path?}', function () {
    return Response::make('', 200, ['Access-Control-Allow-Credentials' => 'true', 'Access-Control-Allow-Headers' => 'Content-Type', 'Access-Control-Allow-Methods' => 'GET, POST, PUT, DELETE, OPTIONS']);
})->where('path', '.+');
Route::group(['prefix' => '/api', 'before' => 'auth', 'after' => 'cors'], function () {
    Route::resource('users', 'UserController', ['except' => ['create', 'edit']]);
    Route::get('/logi/secretKey', ['uses' => 'LogiController@secretKey']);
    Route::get('/crm/token', ['uses' => 'CrmController@token']);
    Route::get('/payeePayment/unpaidPayeePayments', ['uses' => 'PayeePaymentController@unpaidPayeePayments']);
    Route::post('/{model}', ['as' => 'api.entity', 'uses' => 'ApiController@createEntity']);
    Route::put('/{model}/{id}', ['as' => 'api.entity', 'uses' => 'ApiController@updateEntity']);
    Route::delete('/{model}/{id}', ['as' => 'api.entity', 'uses' => 'ApiController@deleteEntity']);
    Route::get('/{model}/{id}/method/{method}', ['as' => 'api.entity', 'uses' => 'ApiController@method']);
    Route::get('/{model}/method/{method}', ['as' => 'api.entity', 'uses' => 'ApiController@methodNoId']);
    Route::get('/royalty_stream_files/{id}/pdf', ['as' => 'api.royalty_stream_files.pdf', 'uses' => 'ApiController@royalty_stream_file_pdf']);
    Route::get('/{model}', ['as' => 'api.collection', 'uses' => 'ApiController@collection']);
    Route::get('/{model}/{id}', ['as' => 'api.entity', 'uses' => 'ApiController@entity']);
    Route::get('/{model}/{id}/{relation}', ['as' => 'api.entity.relation', 'uses' => 'ApiController@relation'])->where('id', '[0-9]+');
开发者ID:alternativex,项目名称:Backend-app,代码行数:31,代码来源:routes.php

示例7: 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.
|
*/
Route::group(['prefix' => 'api', 'namespace' => 'Api'], function () {
    Route::group(['prefix' => 'v1'], function () {
        Route::get('/', ['as' => 'main', 'uses' => 'MainController@index']);
        Route::options('users', 'MainController@options');
        Route::options('users/{user_id}', 'MainController@options');
        Route::options('users/{user_id}/messages', 'MainController@options');
        Route::options('users/{user_id}/messages/{message_id}', 'MainController@options');
        Route::resource('users', 'UsersController', ['except' => ['create', 'edit']]);
        Route::resource('users.messages', 'MessagesController', ['except' => ['create', 'edit']]);
    });
});
Route::get('/', function () {
    return view('welcome');
});
开发者ID:tytarenko,项目名称:messager,代码行数:26,代码来源:routes.php

示例8: register_admin_route

/**
 * Register Admin Route
 */
function register_admin_route($uri, $action = array(), $type = "get")
{
    if ($type == "get") {
        return Route::get(adminAliasPath() . $uri, $action);
    } else {
        if ($type == "post") {
            return Route::post(adminAliasPath() . $uri, $action);
        } else {
            if ($type == "patch") {
                return Route::patch(adminAliasPath() . $uri, $action);
            } else {
                if ($type == "put") {
                    return Route::put(adminAliasPath() . $uri, $action);
                } else {
                    if ($type == "options") {
                        return Route::options(adminAliasPath() . $uri, $action);
                    } else {
                        if ($type == "delete") {
                            return Route::delete(adminAliasPath() . $uri, $action);
                        } else {
                            return Route::any(adminAliasPath() . $uri, $action);
                        }
                    }
                }
            }
        }
    }
}
开发者ID:developeryamhi,项目名称:laravel-admin,代码行数:31,代码来源:admin.php


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