/** * */ public final function setup() { if (method_exists($this, 'boot')) { $this->app->call([$this, 'boot']); } $this->setupCompleted = true; $this->halted = false; }
/** * Create a new instance of Storytelling. * * @param \Illuminate\Contracts\Foundation\Application $app */ public function __construct($app) { $this->app = $app; if (method_exists($this, 'initiate')) { $app->call([$this, 'initiate']); } }
/** * @return \Cocona\Core\Html\Elements\Form */ public function edit($id) { $form = $this->app->call([$this->resource, 'form']); // Create the route param from the name $param = str_replace('-', '_', snake_case($this->resource->name())); $form->action($this->to('update', [$param => $id])); // Spoof the form method and add the CSRF token $form->hidden('_method', 'PUT'); $form->token(); // Fill the form with the model and overwrite it with // the request if is available $form->fill($this->resource->item($id), $this->session->getOldInput()); return $form; }
/** * Register additional routes. * * @param AddonServiceProvider $provider */ protected function registerAdditionalRoutes(AddonServiceProvider $provider) { if ($this->routesAreCached()) { return; } if (method_exists($provider, 'map')) { try { $this->application->call([$provider, 'map']); } catch (\Exception $e) { /* * If, for whatever reason, this fails let * it fail silently. Mapping additional routes * could be volatile at certain application states. */ } } }
/** * Determine if the filters pass for the event. * * @param \Illuminate\Contracts\Foundation\Application $app * @return bool */ public function filtersPass($app) { foreach ($this->filters as $callback) { if (!$app->call($callback)) { return false; } } foreach ($this->rejects as $callback) { if ($app->call($callback)) { return false; } } return true; }
/** * Determine if the filters pass for the event. * * @param \Illuminate\Contracts\Foundation\Application $app * @return bool */ protected function filtersPass(Application $app) { if ($this->filter && !$app->call($this->filter) || $this->reject && $app->call($this->reject)) { return false; } return true; }
/** * Execute the console command. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * @return mixed */ protected function execute(InputInterface $input, OutputInterface $output) { $method = method_exists($this, 'handle') ? 'handle' : 'fire'; return $this->laravel->call([$this, $method]); }