mercredi 26 juin 2019

Why registered service does not working in laravel?

I created service in app/services/SubscriptionService.php

then import it into controller use App\Services\SubscriptionService;

and then in controller

public function subscribeIt(SubscriptionService $SubscriptionService, Request $request){
  $response = $SubscriptionService->subscribeIt($request);
  ...
}

But in result of execution I am getting Class App\Services\SubscriptionService does not exist Do I need to register it in provider ? This is in provider

public function register()
    {
        //
        $this->app->bind('App\Services\SubscriptionService', function ($app)    {
          return new SubscriptionService();
        });
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire