diff --git a/IES-Bandung/app/Http/Controllers/ObjectTypeController.php b/IES-Bandung/app/Http/Controllers/ObjectTypeController.php new file mode 100644 index 0000000000000000000000000000000000000000..cc3e88d0c7b91ef489b0f998e97507c6639d9a75 --- /dev/null +++ b/IES-Bandung/app/Http/Controllers/ObjectTypeController.php @@ -0,0 +1,20 @@ +<?php + +namespace App\Http\Controllers; + +use Illuminate\Http\Request; + +use App\Http\Requests; +use App\Model\ObjectType; + +class ObjectTypeController extends Controller +{ + public function showAllNamesToJSON() { + $types = ObjectType::select('name')->get(); + $result = array(); + foreach ($types as $type) { + $result[] = $type['name']; + } + echo json_encode($result); + } +} diff --git a/IES-Bandung/app/Http/routes.php b/IES-Bandung/app/Http/routes.php index 5d64ec0fe945786d082993debb8e6aea907f83a4..f6673db222264b2bfd8c896c4d021fbb5f14739d 100755 --- a/IES-Bandung/app/Http/routes.php +++ b/IES-Bandung/app/Http/routes.php @@ -30,6 +30,8 @@ Route::post('/item/add', 'ObjectSellController@createObjectSell'); Route::post('/item/update', 'ObjectSellController@updateObjectSell'); Route::post('/item/delete/{id}', ['uses' => 'ObjectSellController@deleteObjectSell']); +Route::get('/api/object_type', 'ObjectTypeController@showAllNamesToJSON'); + Route::get('/market', 'MarketController@index'); Route::get('/debug', function(){