1

i have two routes

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

which i am using like this.

$api = app('Dingo\Api\Routing\Router');
$api->version('v1',function($api) {
$api->get('usersInfo','App\Http\Controllers\ApiController@usersInfo');
$api-    
>get("checkboxbriefs/tbbid/{tbbid}","App\Http\Controllers\
ApiController@testing");

}

I have added

'providers' => [
    Dingo\Api\Provider\LaravelServiceProvider::class
]

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.

Kumar Ravi Singh
  • 181
  • 1
  • 16

1 Answers1

2

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);
        error_reporting(1);

}

where I need to call bellow

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

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

vrkansagara
  • 606
  • 6
  • 13
Kumar Ravi Singh
  • 181
  • 1
  • 16
  • You are right mat... This really helpful after spending the 2 industrial hours. I have looked into my code and found that code is not called with fully qualified name space so it was breaking the functionality. – vrkansagara Sep 21 '16 at 12:46