You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
engelsystem/src/Http/Validation/ValidationServiceProvider.php

26 lines
683 B
PHP

<?php
namespace Engelsystem\Http\Validation;
use Engelsystem\Application;
use Engelsystem\Container\ServiceProvider;
use Engelsystem\Controllers\BaseController;
class ValidationServiceProvider extends ServiceProvider
{
public function register()
{
$validator = $this->app->make(Validator::class);
$this->app->instance(Validator::class, $validator);
$this->app->instance('validator', $validator);
$this->app->afterResolving(function ($object, Application $app) {
if (!$object instanceof BaseController) {
return;
}
$object->setValidator($app->get(Validator::class));
});
}
}