lundi 12 février 2018

Do I need to have Controller.php in all my API subversion?

I am trying to create an API directory in my Laravel project and I'm receiving the following error...

Class 'App\Http\Controllers\Controller' not found

I have tried using use App\Http\Controllers\Controller; on top of my API controllers but no luck.

My API classes are defined like...

class SyncController extends Controller {...}
class TimecardController extends Controller {...}

I'm pretty sure the error is coming from the extends Controller portion.

in App\Http\Controllers\Controller I have Controller.php. One way I have pushed past this is to duplicate the Controller.php into App\Http\Controllers\Api\v2\ and change the namespace of that controller to match where it is located (namespace App\Http\Controllers\Api\v2;)

I don't believe this is correct, as there should be a way to reference the Controller.php from the controllers in the API subdirectory.

../Controllers/Controller.php and API is a subdirectory, ../Controllers/Api/v2/SyncController.php

Any help would be much appreciated.

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire