I tried to make these code. then I send below request uri http://192.168.33.10/api/v1/company?data=test but, it can't get data parameter. Do you know how to get it?
Route.php
$api = app('Dingo\Api\Routing\Router');
$api->version('v1', function ($api) {
/* API */
$api->group(['prefix' => 'v1',
'before' => 'v1',
'middleware' => 'cors',
'namespace' => 'App\\Http\\Controllers',
'domain' => '192.168.33.10'
],function ($api) {
// get company list
$api->get('/company/', "CompaniesController@index");
});
});
controller.php
public function index(UsersCreateRequest $request)
{
var_dump($request->input('data'));
$users = $this->repository->all();
return response()->json([
'data' => $users,
]);
}
input
method returns data of the form inputs. To get the query parameters you should use thequery
method: