D
D
David2016-06-15 12:36:43
Laravel
David, 2016-06-15 12:36:43

Can't find the service provider class?

File app/Providers/CustomRegisterProvider:

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use App\Services\CustomRegister;

class CustomRegisterProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind('App\Services\CustomRegisterContract', function(){
            return new CustomRegister();
        });
    }
}

In controller:
...
use App\Services\CustomRegister as Register;

class RegisterController extends Controller
{
...

/**
     *  Регистрация потребителя
     *
     * @param Request $request
     */
    public function consumer(Request $request, Register $register){
       ...
    }
}

Mistake:

ReflectionException in Route.php line 286:
Class App\Services\CustomRegister does not exist

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2016-06-15
@alexey-m-ukolov

use App\Services\CustomRegister\CustomRegisterProvider as Register;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question