/**
  * Execute the console command.
  *
  * @return void
  */
 public function handle()
 {
     if (ArtisanExt::checkDb()) {
         return $this->info('Succesfully connected to the database.');
     }
     return $this->error('Failed to connect to the database.');
 }
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function handle()
 {
     $permissions_array = ArtisanExt::checkPermissions();
     $count = 0;
     foreach ($permissions_array as $item => $value) {
         if ($value[key($value)] == true) {
             $count++;
             $this->info('The ' . key($value) . ' directory is writable.');
         } else {
             $this->error('The ' . key($value) . ' directory is not writable.');
         }
     }
     if ($count == count($permissions_array)) {
         return $this->info('All permissions are set correctly.');
     }
     return $this->error('Some of your permissions are not set correctly.
                          Check the laravel documentation for the correct ' . 'permissions.');
 }
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function handle()
 {
     $old_db_name = $this->laravel['config']['database.connections.' . $this->laravel['config']['database.default'] . '.database'];
     $file = base_path('.env');
     if (file_exists($file)) {
         file_put_contents($file, str_replace('DB_DATABASE=' . $old_db_name, 'DB_DATABASE=' . $this->argument('databasename'), file_get_contents($file)));
         if ($this->option('check')) {
             $this->info('The database name has been changed ' . 'successfully to: ' . $this->argument('databasename'));
             $this->laravel['config']['database.connections.' . $this->laravel['config']['database.default'] . '.database'] = $this->argument('databasename');
             try {
                 ArtisanExt::checkDb();
                 return $this->info('Succesfully connected to the database.');
             } catch (\PDOException $e) {
                 return $this->error('Failed to connect to the database.');
             }
         }
         return $this->info('The database name has been changed ' . 'successfully to: ' . $this->argument('databasename'));
     }
     return $this->error('The .env configuration file is missing.');
 }