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


PHP Route::api方法代码示例

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


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

示例1: function

<?php

Route::api(['after' => 'allowed_domains', 'namespace' => 'CachetHQ\\Cachet\\Http\\Controllers\\Api', 'version' => 'v1'], function () {
    Route::get('components', 'ComponentController@getComponents');
    Route::get('components/{id}', 'ComponentController@getComponent');
    Route::get('components/{id}/incidents', 'ComponentController@getComponentIncidents');
    Route::get('incidents', 'IncidentController@getIncidents');
    Route::get('incidents/{id}', 'IncidentController@getIncident');
    Route::get('metrics', 'MetricController@getMetrics');
    Route::get('metrics/{id}', 'MetricController@getMetric');
    Route::get('metrics/points/{id}', 'MetricPointController@getMetricPoint');
    Route::group(['protected' => true], function () {
        Route::post('components', 'ComponentController@postComponents');
        Route::post('incidents', 'IncidentController@postIncidents');
        Route::post('metrics', 'MetricController@postMetrics');
        Route::post('metrics/points', 'MetricPointController@postMetricPoints');
        Route::put('components/{id}', 'ComponentController@putComponent');
        Route::put('incidents/{id}', 'IncidentController@putIncident');
        Route::put('metrics/{id}', 'MetricController@putMetric');
    });
});
开发者ID:baa-archieve,项目名称:Cachet,代码行数:21,代码来源:api.php

示例2: function

| REST API
|--------------------------------------------------------------------------
*/
Route::group(['namespace' => 'Zeropingheroes\\Lanager\\Http\\Api\\v1'], function () {
    Route::api(['version' => 'v1'], function () {
        Route::resource('achievements', 'AchievementsController', ['except' => ['create', 'edit']]);
        Route::resource('user-achievements', 'UserAchievementsController', ['except' => ['create', 'edit']]);
        Route::resource('events', 'EventsController', ['except' => ['create', 'edit']]);
        Route::resource('event-signups', 'EventSignupsController', ['except' => ['create', 'edit', 'update']]);
        Route::resource('event-types', 'EventTypesController', ['except' => ['create', 'edit']]);
        Route::resource('pages', 'PagesController', ['except' => ['create', 'edit']]);
        Route::resource('lans', 'LansController', ['except' => ['create', 'edit']]);
        Route::resource('shouts', 'ShoutsController', ['except' => ['create', 'edit']]);
        Route::resource('roles', 'RolesController', ['except' => ['create', 'edit']]);
        Route::resource('user-roles', 'UserRolesController', ['except' => ['create', 'edit', 'update']]);
        Route::resource('users', 'UsersController', ['except' => ['create', 'store', 'edit', 'update']]);
        Route::resource('application-usage', 'ApplicationUsageController', ['except' => ['create', 'show', 'store', 'edit', 'update', 'destroy']]);
        Route::resource('logs', 'LogsController', ['except' => ['create', 'store', 'edit', 'update', 'destroy']]);
        // List of endpoints
        Route::get('/', ['as' => 'api.index', function () {
            $routes = Route::getApiGroups()->getByVersion('v1');
            $endpoints = [];
            foreach ($routes as $route) {
                $endpoints['endpoints'][] = ['path' => $route->getPath(), 'methods' => $route->getMethods()];
            }
            return Response::make($endpoints, 200, [], ['options' => JSON_PRETTY_PRINT]);
        }]);
    });
});
/*
|--------------------------------------------------------------------------
| Index
开发者ID:PoxyDoxy,项目名称:lanager,代码行数:32,代码来源:routes.php

示例3: function

Route::filter('auth', function () {
    if (Auth::guest()) {
        return Redirect::make('', 401);
    }
});
// --------------------------------------------------------------
// Setting system tables
// --------------------------------------------------------------
DBManager::$hidden = Config::get('domain::dbmanager.hidden');
$api_version = Config::get('layla.domain.api.version');
// --------------------------------------------------------------
// Map the Base Controller
// --------------------------------------------------------------
Autoloader::map(array('Domain_Base_Controller' => __DIR__ . DS . 'controllers' . DS . 'base' . EXT));
Route::filter('api_auth', function () {
    if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {
        //return Response::json(array(), 401);
    }
    //Auth::attempt();
});
Bundle::start('thirdparty_bob');
// --------------------------------------------------------------
// Load the routes
// --------------------------------------------------------------
Route::group(array('before' => 'api_auth'), function () use($api_version) {
    Route::api(Config::get('routes'), 'domain', Config::get('layla.domain.url_prefix'));
});
// --------------------------------------------------------------
// Set aliases
// --------------------------------------------------------------
Autoloader::alias('Domain\\Libraries\\Response', 'Response');
开发者ID:reith2004,项目名称:domain,代码行数:31,代码来源:start.php

示例4: array

    // GEt fetchAll/{orderBy}/{order} -- Get all metadatas
    Route::get('fetchAll/{orderBy}/{order}', array('uses' => 'MetadatasController@all'));
});
// Confide RESTful route
Route::api(array('version' => 'v1', 'prefix' => 'api'), function () {
    Route::post('users', array('uses' => 'UsersController@postIndex', 'as' => 'register'));
    Route::post('users/login', array('uses' => 'UsersController@postLogin', 'as' => 'login'));
    Route::post('users/forgot', array('uses' => 'UsersController@postForgot', 'as' => 'forgot'));
    Route::post('users/reset', array('uses' => 'UsersController@postReset', 'as' => 'reset'));
    Route::get('users/confirm/{code}', array('uses' => 'UsersController@getConfirm', 'as' => 'confirm'));
    Route::get('users/reset_password/{token}', array('uses' => 'UsersController@getReset', 'as' => 'reset'));
    Route::post('users/reset_password', array('uses' => 'UsersController@postReset'));
    Route::resource('docs', 'DocsController', array('except' => array('create', 'edit')));
    Route::group(array('protected' => true, 'providers' => 'jwt'), function () {
        Route::get('users', function () {
            return API::user();
        });
        Route::put('users/{id}', array('as' => 'updateUser', 'uses' => 'UsersController@putIndex'));
        Route::get('users/logout', array('as' => 'logout', 'uses' => 'UsersController@getLogout'));
        Route::post('creators', array('as' => 'create.creator', 'uses' => 'CreatorsController@store'));
        Route::put('creators', array('as' => 'update.creator', 'uses' => 'CreatorsController@update'));
        Route::get('creators', array('as' => 'get.creator', 'uses' => 'CreatorsController@show'));
        /**
         * Scheduler routes
         */
        Route::resource('scheduler', 'SchedulersController');
    });
});
Route::post('refresh', function () {
    $token = Input::get('token');
    return JWTAuth::refresh($token);
});
开发者ID:rahmanda,项目名称:matome,代码行数:32,代码来源:routes.php

示例5: function

Route::api(['namespace' => 'BFACP\\Http\\Controllers\\Api', 'version' => 'v1'], function () {
    /*===================================
      =            API Players            =
      ===================================*/
    Route::group(['prefix' => 'players'], function () {
        Route::get('/', ['as' => 'api.players.index', 'uses' => 'PlayersController@index']);
        Route::get('{id}', ['as' => 'api.players.show', 'uses' => 'PlayersController@show'])->where('id', '[0-9]+');
        Route::get('{id}/records', ['as' => 'api.players.show.records', 'uses' => 'PlayersController@showRecords'])->where('id', '[0-9]+');
        Route::get('{id}/chatlogs', ['as' => 'api.players.show.chatlogs', 'uses' => 'PlayersController@showChatlogs'])->where('id', '[0-9]+');
    });
    /*=====================================
      =            API Battlelog            =
      =====================================*/
    Route::group(['prefix' => 'battlelog'], function () {
        Route::group(['prefix' => 'players'], function () {
            Route::get('{player}/weapons', ['as' => 'api.battlelog.players.weapons', function (BFACP\Battlefield\Player $player) {
                $battlelog = App::make('BFACP\\Libraries\\Battlelog\\BPlayer', [$player]);
                return MainHelper::response($battlelog->getWeaponStats(), null, null, null, false, true);
            }])->where('player', '[0-9]+');
            Route::get('{player}/overview', ['as' => 'api.battlelog.players.overview', function (BFACP\Battlefield\Player $player) {
                $battlelog = App::make('BFACP\\Libraries\\Battlelog\\BPlayer', [$player]);
                return MainHelper::response($battlelog->getOverviewStats(), null, null, null, false, true);
            }])->where('player', '[0-9]+');
            Route::get('{player}/vehicles', ['as' => 'api.battlelog.players.vehicles', function (BFACP\Battlefield\Player $player) {
                $battlelog = App::make('BFACP\\Libraries\\Battlelog\\BPlayer', [$player]);
                return MainHelper::response($battlelog->getVehicleStats(), null, null, null, false, true);
            }])->where('player', '[0-9]+');
            Route::get('{player}/reports', ['as' => 'api.battlelog.players.reports', function (BFACP\Battlefield\Player $player) {
                $battlelog = App::make('BFACP\\Libraries\\Battlelog\\BPlayer', [$player]);
                return MainHelper::response($battlelog->getBattleReports(), null, null, null, false, true);
            }])->where('player', '[0-9]+');
            Route::get('{player}/acs', ['as' => 'api.battlelog.players.acs', function (BFACP\Battlefield\Player $player) {
                $acs = App::make('BFACP\\Libraries\\AntiCheat', [$player]);
                $data = $acs->parse($acs->battlelog->getWeaponStats())->get();
                return MainHelper::response($data, null, null, null, false, true);
            }])->where('player', '[0-9]+');
        });
    });
    /*================================
      =            API Bans            =
      ================================*/
    Route::group(['prefix' => 'bans'], function () {
        Route::get('latest', ['as' => 'api.bans.latest', 'uses' => 'BansController@latest']);
        Route::get('stats', ['as' => 'api.bans.stats', 'uses' => 'BansController@stats']);
        Route::group(['prefix' => 'metabans'], function () {
            Route::get('/', ['as' => 'api.bans.metabans.index', 'uses' => 'MetabansController@getIndex']);
            Route::get('feed', ['as' => 'api.bans.metabans.feed', 'uses' => 'MetabansController@getFeed']);
            Route::get('assessments', ['as' => 'api.bans.metabans.assessments', 'uses' => 'MetabansController@getAssessments']);
            Route::get('feed_assessments', ['as' => 'api.bans.metabans.feed_assessments', 'uses' => 'MetabansController@getFeedAssessments']);
        });
    });
    /*===================================
      =            API Servers            =
      ===================================*/
    Route::group(['prefix' => 'servers'], function () {
        Route::get('population', ['as' => 'api.servers.population', 'uses' => 'ServersController@population']);
        Route::get('scoreboard/{id}', ['as' => 'api.servers.scoreboard', 'uses' => 'ServersController@scoreboard'])->where('id', '[0-9]+');
        Route::get('scoreboard/roundstats/{id}', ['as' => 'api.servers.scoreboard.roundstats', 'uses' => 'ServersController@scoreboardExtra'])->where('id', '[0-9]+');
        Route::get('chat/{id}', ['as' => 'api.servers.chat', 'uses' => 'ServersController@chat'])->where('id', '[0-9]+');
        Route::post('scoreboard/admin', ['as' => 'api.servers.scoreboard.admin', 'uses' => 'ServersController@scoreboardAdmin']);
    });
    /*====================================
      =            API Chatlogs            =
      ====================================*/
    Route::group(['prefix' => 'chatlogs'], function () {
        Route::get('/', ['as' => 'api.chatlogs.index', 'uses' => 'ChatlogController@getIndex']);
    });
});
开发者ID:R3alflash,项目名称:BFAdminCP,代码行数:68,代码来源:routes.php

示例6: function

Route::api(['namespace' => 'BFACP\\Http\\Controllers\\Api', 'version' => 'v1'], function () {
    /*===================================
      =            API Resources          =
      ===================================*/
    Route::group(['prefix' => 'helpers'], function () {
        Route::group(['prefix' => 'adkats'], function () {
            Route::get('special_groups', 'HelpersController@getSpecialGroups');
        });
        Route::get('online/admins', 'HelpersController@onlineAdmins');
        Route::get('ip/{addy}', 'HelpersController@iplookup');
        Route::get('squads', function () {
            $squads = [];
            for ($i = 0; $i <= 32; $i++) {
                $squads[] = ['id' => $i, 'name' => BattlefieldHelper::squad($i)];
            }
            return $squads;
        });
    });
    /*===================================
      =            API Players            =
      ===================================*/
    Route::group(['prefix' => 'players'], function () {
        Route::get('/', ['as' => 'api.players.index', 'uses' => 'PlayersController@index']);
        Route::get('{id}', ['as' => 'api.players.show', 'uses' => 'PlayersController@show'])->where('id', '[0-9]+');
        Route::get('{id}/records', ['as' => 'api.players.show.records', 'uses' => 'PlayersController@showRecords'])->where('id', '[0-9]+');
        Route::get('{id}/chatlogs', ['as' => 'api.players.show.chatlogs', 'uses' => 'PlayersController@showChatlogs'])->where('id', '[0-9]+');
        Route::get('{id}/sessions', ['as' => 'api.players.show.sessions', 'uses' => 'PlayersController@showSessions'])->where('id', '[0-9]+');
    });
    /*=====================================
      =            API Battlelog            =
      =====================================*/
    Route::group(['prefix' => 'battlelog'], function () {
        Route::group(['prefix' => 'players'], function () {
            Route::get('{player}/weapons', ['as' => 'api.battlelog.players.weapons', 'uses' => 'BattlelogController@getWeapons'])->where('player', '[0-9]+');
            Route::get('{player}/overview', ['as' => 'api.battlelog.players.overview', 'uses' => 'BattlelogController@getOverview'])->where('player', '[0-9]+');
            Route::get('{player}/vehicles', ['as' => 'api.battlelog.players.vehicles', 'uses' => 'BattlelogController@getVehicles'])->where('player', '[0-9]+');
            Route::get('{player}/reports', ['as' => 'api.battlelog.players.reports', 'uses' => 'BattlelogController@getReports'])->where('player', '[0-9]+');
            Route::get('{player}/report/{id}', ['as' => 'api.battlelog.players.report', 'uses' => 'BattlelogController@getReport'])->where('player', '[0-9]+')->where('id', '[0-9]+');
            Route::get('{player}/acs', ['as' => 'api.battlelog.players.acs', 'uses' => 'BattlelogController@getCheatDetection'])->where('player', '[0-9]+');
        });
    });
    /*================================
      =            API Bans            =
      ================================*/
    Route::group(['prefix' => 'bans'], function () {
        Route::get('latest', ['as' => 'api.bans.latest', 'uses' => 'BansController@latest']);
        Route::get('stats', ['as' => 'api.bans.stats', 'uses' => 'BansController@stats']);
        Route::group(['prefix' => 'metabans'], function () {
            Route::get('/', ['as' => 'api.bans.metabans.index', 'uses' => 'MetabansController@getIndex']);
            Route::get('feed', ['as' => 'api.bans.metabans.feed', 'uses' => 'MetabansController@getFeed']);
            Route::get('assessments', ['as' => 'api.bans.metabans.assessments', 'uses' => 'MetabansController@getAssessments']);
            Route::get('feed_assessments', ['as' => 'api.bans.metabans.feed_assessments', 'uses' => 'MetabansController@getFeedAssessments']);
        });
    });
    /*===================================
      =            API Servers            =
      ===================================*/
    Route::group(['prefix' => 'servers'], function () {
        Route::get('population', ['as' => 'api.servers.population', 'uses' => 'ServersController@population']);
        Route::get('scoreboard/{id}', ['as' => 'api.servers.scoreboard', 'uses' => 'ServersController@scoreboard'])->where('id', '[0-9]+');
        Route::get('scoreboard/roundstats/{id}', ['as' => 'api.servers.scoreboard.roundstats', 'uses' => 'ServersController@scoreboardExtra'])->where('id', '[0-9]+');
        Route::get('chat/{id}', ['as' => 'api.servers.chat', 'uses' => 'ServersController@chat'])->where('id', '[0-9]+');
        Route::controller('admin/scoreboard', 'Admin\\ScoreboardController');
    });
    /*====================================
      =            API Chatlogs            =
      ====================================*/
    Route::group(['prefix' => 'chatlogs'], function () {
        Route::get('/', ['as' => 'api.chatlogs.index', 'uses' => 'ChatlogController@getIndex']);
    });
    /*===================================
      =            API Reports            =
      ===================================*/
    Route::controller('reports', 'ReportsController');
});
开发者ID:BP4U,项目名称:BFAdminCP,代码行数:75,代码来源:routes.php

示例7: function

<?php

/*
|--------------------------------------------------------------------------
| Status Route :: status
|--------------------------------------------------------------------------
*/
Route::get('/status', function () {
    return "Feeling yummy :)";
});
/*
|--------------------------------------------------------------------------
| API Server Routes 
|--------------------------------------------------------------------------
*/
Route::api(['version' => 'v1', 'prefix' => 'api'], function () {
    // Users routes
    Route::post('users', 'UserController@add');
    Route::get('users/{id}', 'UserController@detail');
    Route::put('users/{id}', 'UserController@update');
    Route::delete('users/{id}', 'UserController@delete');
    // Orders routes
    Route::post('orders', 'OrderController@add');
    Route::get('orders/{id}', 'OrderController@detail');
    Route::put('orders/{id}', 'OrderController@update');
    Route::delete('orders/{id}', 'OrderController@delete');
    // Items routes
    Route::get('items', 'ItemController@lists');
});
开发者ID:prady00,项目名称:Laravel-Swagger-REST,代码行数:29,代码来源:routes.php

示例8: function

            $call->status = Input::get('status');
            $call->price = Input::get('call-price');
            $call->rate = Input::get('call-rate');
            $call->duration = Input::get('call-duration');
            $call->start_time = Input::get('call-start');
            $call->end_time = Input::get('call-end');
            $call->direction = Input::get('call-direction');
            $call->save();
    }
    return Response::make('OK');
});
/* API */
Route::api(['version' => 'v1', 'protected' => true], function () {
    Route::post('inbound/reply', 'InboundController@postReply');
    Route::resource('inbound', 'InboundController', array('only' => array('index', 'show')));
    Route::resource('outbound', 'OutboundController', array('only' => array('index', 'show', 'store')));
    Route::get('number/calls', 'NumberController@getCalls');
    Route::get('number/search/{country_code}', 'NumberController@getSearch');
    Route::resource('number', 'NumberController', array('only' => array('index', 'show', 'store', 'update', 'destroy')));
});
/* VoiceXML Sample */
Route::get('voicexml.xml', function () {
    $xml = <<<EOT
<?xml version="1.0" encoding="UTF-8"?>
\t<vxml version = "2.1">
  \t\t<form>
    \t\t<block>
    \t\t\t<prompt>
      \t\t\t\tSurprise madafaka!
    \t\t\t</prompt>
    \t\t</block>
  \t\t</form>
开发者ID:aa6my,项目名称:nexmo-dashboard,代码行数:32,代码来源:routes.php


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