0
votes

I have a Laravel Application and it uses Dingo Router:

 $api->get('/cash-flow', 'App\Http\Controllers\ReportController@cashFlowReport');

When my front-end calls this api, it gets 200 responses from OPTIONS & GET. However, it does not successfully pass in the GET variables.

 public function cashFlowReport(Request $request)
{
    $input = $request->all();
    return var_dump($input);
}

The response returns an empty array. I thought it was the Request class dependency but I think it would throw an error when it tries to access the parameter.

I have the Request Dependency:

use Illuminate\Http\Request;
1
are you using nginx? - lagbox
Yes I am @lagbox, - Kenta Goto
can you please provide the try_files line from the location / block of the site configuration file? - lagbox
Yup this was it. I saw it on another post. I had to add $variable to the end - Kenta Goto
yea that was where i was going with that ... you should have just replied to my question and saved yourself an hour ;) - lagbox

1 Answers

2
votes

If you are using nginx you will want to make sure the query string is actually making it through the 'rewrite'/'pretty url' process.

From the Laravel installation documentation for Pretty Urls:

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

The ?$query_string part is important.

Laravel Docs - Installation - Pretty Urls