blob: 14530ae683cdb14b9ca4816a803fe0829e6111c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<?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));
});
}
}
|