예제 #1
0
})->where('any', '(.*)\\/$');
// Route::get('products', array('as' => 'products', 'uses' => 'ProductsController@getIndex'));
/*
|--------------------------------------------------------------------------
| The API
|--------------------------------------------------------------------------
|
|
|
*/
// Route::get('eventts/api', function(){ return Response::json(['eventts'=> json_decode(Eventt::all())]);});
// Route::get('test', function(){ return All::getSidelink(); });
// Route::get('api', function(){ return All::getRandomRecords(); });
// Route::get('api', function(){ return All::getLatestRecords(); });
Route::get('api', function () {
    return All::getAllRecords();
});
Route::post('api', function () {
    return All::getCoveredRecords();
});
Route::get('api/search', function () {
    return All::ajaxByLetters();
});
Route::get('{path}/api', function ($path) {
    return All::getModelRecords();
});
Route::get('{resource}/{id}/api', function ($resource, $id) {
    return All::getRecord($resource, $id);
})->where('id', '[0-9]+');
Route::get('{resource}/{id}/edit/api', function ($resource, $id) {
    return All::getRecord($resource, $id);
예제 #2
0
 public function getRecords()
 {
     $records = All::getAllRecords();
     return $records;
 }
예제 #3
0
파일: All.php 프로젝트: chris27tina/TODO
 public static function ajaxByLetters()
 {
     $term = Input::get('term');
     $api = All::getAllRecords();
     // $api = substr($term, 1) ? $api : $this->getAllRecords();//query only once
     $coll = array();
     foreach ($api as $key => $record) {
         foreach ($record as $key => $field) {
             if (count($coll) < 10) {
                 if (stripos('x' . $field, $term)) {
                     //stripos starts at char 1 not 0
                     $coll[$record['model_path'] . $record['id']] = array('model' => $record['model'], 'model_path' => $record['model_path'], 'name' => $record['name'], 'id' => $record['id'], 'location' => $record['location'], 'field' => $key);
                 }
             }
         }
     }
     return Response::json($coll);
 }