/** * Register the service provider. * * @return void */ public function register() { require_once __DIR__ . '/helpers.php'; require_once __DIR__ . '/blade.php'; $this->app->afterResolving(Controller::class, function (Controller $controller, Application $app) { $app->call([$controller, 'boot']); if (method_exists($controller, 'ready')) { $app->call([$controller, 'ready']); } if (method_exists($controller, 'protect')) { $app->call([$controller, 'protect']); } }); Dictionary::setEventDispatcher($this->app[Dispatcher::class]); $this->app->register(TabulatorServiceProvider::class); $this->app->register(MessagingServiceProvider::class); $this->app->register(TabulatorServiceProvider::class); $this->app->register(HtmlServiceProvider::class); $this->app->singleton(GateContract::class, function ($app) { return new Gate($app, function () use($app) { return $app['auth']->user(); }); }); }
/** * @param Dictionary $metaBag */ protected function validateBag(Dictionary $metaBag) { if (empty($this->rules)) { return; } $validator = self::$validator->make($metaBag->toArray(), $this->rules); if ($validator->fails()) { throw new InvalidMetaException($validator->getMessageBag()); } }