vendredi 17 avril 2020

Laravel 5 IOC not working with ValidationException injection

I've created a file call ModuleServiceProvider.php, in register method I add:

public function register()
    {
        // override query builder pagination
        $this->app->singleton(
            'Illuminate\\Pagination\\LengthAwarePaginator',
            'App\\Helpers\\LengthAwarePaginator'
        );
        $this->app->singleton(
            'Illuminate\\Validation\\ValidationException',
            'App\\Helpers\\ValidationException'
        );
    }

As you can see, I can override LengthAwarePaginator class but I can not with ValidationException. I dont remember command which can help me create cache file, in this I can see one line like that 'Illuminate\Pagination\LengthAwarePaginator' => 'App\Helpers\LengthAwarePaginator'. My question is:

  1. Which command is?
  2. Why dont I override ValidationException and why it does not working?
  3. Where I can see list of override class?


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire