jeudi 29 septembre 2016

Laravel resolve helper returns string

I have a binding in my AppServiceProvider:

$this->app->bind(
    'App\Services\Avatars\Contracts\AvatarServiceInterface',
    'App\Services\Avatars\GravatarAvatarService'
);

If I inject the AvatarServiceInterface into a controller constructor or method then it correctly returns an instance of the GravatarAvatarService class. However, if I try to use the resolve helper in a controller method (or anywhere else for that matter), e.g.:

$instance = resolve('App\Services\Avatars\Contracts\AvatarServiceInterface');
var_dump($instance);

...it is just returning a string of whatever I'm asking it to resolve. In the example above it returns:

'App\Services\Avatars\Contracts\AvatarServiceInterface' (length=53)

The resolve helper was working for me up until a few days ago. I've tried running composer update to get the latest version of the framework but that hasn't solved this issue.

Anyone have any ideas?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2dbBXfM
via IFTTT

Aucun commentaire:

Enregistrer un commentaire