Kumar Ravi Singh Kumar Ravi Singh - 1 year ago 93
PHP Question

Laravel dingo api not recognizing the method giving error Method [testing] does not exist

i have two routes

1. $api->get('usersInfo','App\Http\Controllers\ApiController@usersInfo');
2. $api->get("checkboxbriefs/tbbid/{tbbid}","App\Http\Controllers\

which i am using like this.

$api = app('Dingo\Api\Routing\Router');
$api->version('v1',function($api) {


I have added

'providers' => [

in providers.

have Also corrected config.

i am getting error in second route as :

"message":"Method [testing] does not exist.","status_code":500,"debug":

first route is working fine without any issue.

Answer Source

For anyone who is looking for solution of such problem.

There is nothing wrong with the implementation try to go threw your code and find any error in controller there must be some.

If you will create new controller with different name and place one function there, calling that function you will get variable value passed threw route.

At least that is what happened in my case.

I created new controller with different name containing only single function and it worked leaving me to assume there are some errors in my script, after editing everything worked fine.

This kind of error comes up with Laravel5.* version while you have not called fully qualified class name. like I have called

if (App::environment('local')) {
        ini_set('display_errors', E_ALL);


where I need to call bellow

if (\App::environment('local')) {
            ini_set('display_errors', E_ALL);

Error Example {"message":"Class 'App\\Http\\Controllers\\App' not found","status_code":500}

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download