Sebpro\ArtisanExt\ArtisanExt::checkPermissions PHP Метод

checkPermissions() публичный статический Метод

Checks the directory permissions.
public static checkPermissions ( ) : array
Результат array
    public static function checkPermissions()
    {
        $storage_bool = false;
        $bootstrap_cache_bool = false;
        if (is_writable(base_path('storage'))) {
            printf(base_path('storage'));
            $storage_bool = true;
        }
        if (is_writable(base_path('bootstrap/cache'))) {
            printf(base_path('bootstrap/cache'));
            $bootstrap_cache_bool = true;
        }
        return [['bootstrap/cache' => $bootstrap_cache_bool], ['storage' => $storage_bool]];
    }

Usage Example

Пример #1
0
 /**
  * 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.');
 }