laravel / octane

Supercharge your Laravel application's performance.
https://laravel.com/docs/octane
MIT License
3.78k stars 296 forks source link

Contracts\Validation\Factory is not instantiable while building #361

Closed dmouse closed 3 years ago

dmouse commented 3 years ago

Description:

I'm using a combination of tenancy for laravel and lighthouse, when I execute request in more than one domain at the same time I got this error:

[2021-08-08 04:33:32] local.ERROR: Target [Illuminate\Contracts\Validation\Factory] is not instantiable while building [Nuwave\Lighthouse\Validation\ValidateDirective]. {"exception":"[object] (Illuminate\\Contracts\\Container\\BindingResolutionException(code: 0): Target [Illuminate\\Contracts\\Validation\\Factory] is not instantiable while building [Nuwave\\Lighthouse\\Validation\\ValidateDirective]. at /var/www/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:1089)

ValidateDirective use Illuminate\Validation\Factory, I tried to create a singleton of Illuminate\Validation\Factory with the below code but the error persist,

use Illuminate\Contracts\Validation\Factory as FactoryContract;
use Illuminate\Validation\Factory;

public function register()
{
       $this->app->singleton(FactoryContract::class, function ($app) {
            return new Factory(
                $app->make(\Illuminate\Contracts\Translation\Translator::class),
                $app
            );
        });
}
use Illuminate\Validation\Factory;

public function register()
{
       $this->app->singleton(Factory::class, function ($app) {
            return new Factory(
                $app->make(\Illuminate\Contracts\Translation\Translator::class),
                $app
            );
        });
}

Any advice or do you think is a bug?

driesvints commented 3 years ago

Hi there,

Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.