4 years ago

Lumen - $request not found

Posted 4 years ago by turkalicious

Route file

$app->get('/api/{zipCode}', [ 'uses' => 'App\Http\Controllers\ApiController@displayInfo' ] );

and the function response

use Illuminate\Http\Request;
// more stuff in between
// function return
 return response()->json(['name' => 'Abigail', 'state' => 'CA'])

PHP function that the router calls does nothing but the return statement above. I've set it up just to experiment. Lumen set up is running on homestead with no problems - apart from the current issue haha.

I have another app running on my host machine that is a MEAN stack. I am using angular's http.jsonp to get the response from my lumen app. However, when I visit an example lumen url on chrome it returns the following

ErrorException in ApiController.php line 53:
Undefined variable: request

Please sign in or create an account to participate in this conversation.