lundi 5 août 2019

Target [App\Service\InvitationServiceInterface] is not instantiable?

I have service provider:

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class InvitationServiceProvider extends ServiceProvider
{
    /**
     * Register services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind('App\Service\InvitationServiceInterface', 'App\Service\InvitationService');
    }

    /**
     * Bootstrap services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }
}

Also there is an custom interface InvitationServiceInterface and InvitationService:

<?php
namespace App\Service;

class InvitationService implements InvitationServiceInterface
{
    public function doAwesomeThing()
    {
        echo 'Do...';
    }
}

Interface is:

<?php
namespace App\Service;

interface InvitationServiceInterface
{
    public function doAwesomeThing();
}

These both files are place in path:

App\Service\InvitationServiceInterface
App\Service\InvitationService

So, I get an error:

Illuminate \ Contracts \ Container \ BindingResolutionException Target [App\Service\InvitationServiceInterface] is not instantiable.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire