protected function loadCurrentApplication() { if ($this->app->runningInConsole()) { $application = new Application(['name' => 'Soda CMS']); $application->url = new ApplicationUrl(['domain' => 'soda.dev', 'folder' => '']); } else { $application = Application::with('url')->whereHas('url', function ($q) { $domain = $this->app->request->getHttpHost(); $q->where('domain', $domain)->where(function ($sq) { $folder = $this->app->request->segment(1) == null ? '' : $this->app->request->segment(1); $sq->where('folder', $folder)->orWhere('folder', ''); })->orderBy('folder', 'DESC'); })->first(); } $this->application = $application; return $this; }
/** * Determine if we are running in the console. * * @return bool * @static */ public static function runningInConsole() { return \Illuminate\Foundation\Application::runningInConsole(); }
/** * 是否运行在命令行内部 * @return bool */ public function inConsole() { return $this->app->runningInConsole(); }
/** * Override */ public function runningInConsole() { if (defined('FAKE_NOT_IN_CONSOLE')) { return !FAKE_NOT_IN_CONSOLE; } else { return parent::runningInConsole(); } }
/** * Determine if the application is running unit tests. * * @return bool */ protected function runningUnitTests() { return $this->app->runningInConsole() && $this->app->runningUnitTests(); }
/** * Determine if the application is running in the console. * * @return bool */ protected function runningInConsole() { return $this->app->runningInConsole(); }
public function __construct(App $app) { if (!$app->runningInConsole()) { $this->authorize('permission_admin'); } }
/** * Create a new SaveUrlMiddleware instance * * @param Store $store * @param Config $config * @return void */ public function __construct(Application $app) { $this->store = $app['session.store']; $this->sessionKey = $app['config']->get('save-url.session-key'); $this->isRunningInConsole = !$app->environment('testing') && $app->runningInConsole(); }