コード例 #1
0
ファイル: FrontController.php プロジェクト: jmramos02/roamio
 public function getById($id)
 {
     $entries = Entry::with('locations')->with('participants')->with('tags')->with('days')->with('hours')->where('id', $id)->orderBy('created_at', 'desc')->get();
     header("Access-Control-Allow-Origin: *");
     header("Access-Control-Allow-Credentials: true ");
     header("Access-Control-Allow-Methods: OPTIONS, GET, POST");
     header("Access-Control-Allow-Headers: Content-Type, Depth, User-Agent, X-File-Size, \n          X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control");
     return $entries->toJson();
 }
コード例 #2
0
ファイル: routes.php プロジェクト: jmramos02/roamio
<?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.
|
*/
use App\Entry;
Route::get('/', function () {
    return view('welcome');
});
Route::group(['prefix' => 'api', 'after' => 'CORS'], function () {
    Route::get('test', function () {
        $entries = Entry::with('locations')->with('participants')->with('tags')->with('days')->with('hours')->get();
        return $entries->toJson();
    });
    Route::get('get-by-rating', 'FrontController@getByHighestRating');
    Route::get('get-by-id/{id}', 'FrontController@getById');
    Route::get('get-by-date', 'FrontController@getByCreatedAt');
    Route::get('search', 'FrontController@search');
    Route::get('/bot/update', 'BotController@getUpdates');
});