public function __construct($init = false) { $this->filter = ['filter' => [], 'setSize' => '10', 'bookmarkKey' => '']; if (!App::runningInConsole() || App::runningInConsole() && $init == true) { $this->client = new NTLMSoapClient(config('levapp.navision.url')); } }
/** * Bootstrap any application services. * * @return void */ public function boot() { if (!App::runningInConsole()) { //código para não executar quando estamos rodando a aplicação via console ProjectTask::created(function ($task) { Event::fire(new TaskWasIncluded($task)); }); } }
/** * Register any application authentication / authorization services. * * @param \Illuminate\Contracts\Auth\Access\Gate $gate * @return void */ public function boot(GateContract $gate) { $this->registerPolicies($gate); if (!App::runningInConsole()) { foreach ($this->getPermissions() as $permission) { $gate->define($permission->name, function ($user) use($permission) { return $user->hasRole($permission->roles) || $user->isAdmin(); }); } } }
/** * Determine whether audit enabled. * * @return bool */ public static function isAuditEnabled() { if (App::runningInConsole() && !Config::get('auditing.audit_console')) { return false; } return true; }
protected function beforeRoute() { if (App::runningInConsole()) { return; } $request = request(); $locales = app('translator.manager')->getLocales(); if (!$locales) { $locales = [app()->getLocale() => app()->getLocale()]; } if (array_key_exists($request->segment(1), $locales)) { $this->serverModify($request, $locales); } }
/** * Register the service provider. * * @return void */ private function registerIfNotInstalled() { $filemanager = $this->app['installer']->getFileManager(); include_once __DIR__ . '/Routes/routes.php'; if (($install = $filemanager->isInstalled()) !== false ? $filemanager->isUpdatable() : true) { if (App::runningInConsole()) { if ($this->allowCommand()) { return; } exit('You must run command: php artisan ' . (!$install ? 'app:install' : 'app:upgrade')); } if (!$this->app['request']->is('Installer@*') && !$this->app['request']->is('*/Installer@*')) { $this->redirectTo(route(!$install ? 'installer::welcome' : 'installer::upgrade')); } } }
return View::make('404'); } }); App::error(function (InvalidOpenIdMessageException $exception, $code) { Log::error($exception); if (!App::runningInConsole()) { $checkpoint_service = ServiceLocator::getInstance()->getService(UtilsServiceCatalog::CheckPointService); if ($checkpoint_service) { $checkpoint_service->trackException($exception); } return View::make('404'); } }); App::error(function (InvalidOAuth2Request $exception, $code) { Log::error($exception); if (!App::runningInConsole()) { $checkpoint_service = ServiceLocator::getInstance()->getService(UtilsServiceCatalog::CheckPointService); if ($checkpoint_service) { $checkpoint_service->trackException($exception); } return View::make('404'); } }); /* |-------------------------------------------------------------------------- | Maintenance Mode Handler |-------------------------------------------------------------------------- | | The "down" Artisan command gives you the ability to put an application | into maintenance mode. Here, you will define what is displayed back | to the user if maintenace mode is in effect for this application.
/** * A little hack to reconnect to the database if we're in console mode and trying to find a deployment. * Should fix the error sending STMT_PREPARE problem that causes deployments to sit "pending" forever. * @return mixed */ public function findOrFail() { if (App::runningInConsole()) { DB::reconnect(); } return parent::__call('findOrFail', func_get_args()); }