iamoskvin
6 months ago
30
0
Lumen

Type-hint dependency in controller does not work

Posted 6 months ago by iamoskvin

Hello, could you help me, pls?

I have created service: OdataService. Then in the controller I can get a service instance like that:

$odata = app(OdataService::class).

But I can not do this just with type-hint in controller method/constructor:

public function __construct(OdataService $odata)
    {   
    //ReflectionException: Class App\Services\OdataService does not exist
    }

Lumen 5.8.4, homestead.

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