Вход Регистрация
Файл: app/Console/Commands/AppPermission.php
Строк: 42
<?php

namespace AppConsoleCommands;

use 
IlluminateConsoleCommand;
use 
IlluminateFilesystemFilesystem;
use 
SymfonyComponentConsoleCommandCommand as SymfonyCommand;

class 
AppPermission extends Command
{
    
/**
     * The name and signature of the console command.
     */
    
protected $signature = 'app:permission';

    
/**
     * The console command description.
     */
    
protected $description = 'Set file permissions';

    
/**
     * Execute the console command.
     */
    
public function handle(Filesystem $filesystem): int
    
{
        
$storage = glob(storage_path('{*,*/*,*/*/*}'), GLOB_BRACE | GLOB_ONLYDIR);
        
$uploads = glob(public_path('uploads/*'), GLOB_ONLYDIR);
        
$dirs = [public_path('assets/modules'), base_path('bootstrap/cache'), base_path('modules')];

        
$dirs = array_merge($storage, $uploads, $dirs);

        foreach (
$dirs as $dir) {
            
$filesystem->chmod($dir, 0755);
        }

        
$this->info('Permissions set successfully.');

        return 
SymfonyCommand::SUCCESS;
    }
}
Онлайн: 2
Реклама