Example #1
0
 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;
 }
Example #2
0
 /**
  * Determine if we are running in the console.
  *
  * @return bool 
  * @static 
  */
 public static function runningInConsole()
 {
     return \Illuminate\Foundation\Application::runningInConsole();
 }
Example #3
0
 /**
  * 是否运行在命令行内部
  * @return bool
  */
 public function inConsole()
 {
     return $this->app->runningInConsole();
 }
Example #4
0
 /**
  * Override
  */
 public function runningInConsole()
 {
     if (defined('FAKE_NOT_IN_CONSOLE')) {
         return !FAKE_NOT_IN_CONSOLE;
     } else {
         return parent::runningInConsole();
     }
 }
Example #5
0
 /**
  * Determine if the application is running unit tests.
  *
  * @return bool
  */
 protected function runningUnitTests()
 {
     return $this->app->runningInConsole() && $this->app->runningUnitTests();
 }
Example #6
0
 /**
  * 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');
     }
 }
Example #8
0
 /**
  *  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();
 }