mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-11-04 06:23:17 -05:00 
			
		
		
		
	* Create PHP CS Fixer config and add to CI workflow * Run php cs fixer on project * Add newline at end of file * Update to use PHP CS Fixer v3 * Run v3 config on project * Run seperate config in CI
		
			
				
	
	
		
			123 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			123 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace Crater\Http\Requests;
 | 
						|
 | 
						|
use Illuminate\Foundation\Http\FormRequest;
 | 
						|
 | 
						|
class DiskEnvironmentRequest extends FormRequest
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * Determine if the user is authorized to make this request.
 | 
						|
     *
 | 
						|
     * @return bool
 | 
						|
     */
 | 
						|
    public function authorize()
 | 
						|
    {
 | 
						|
        return true;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Get the validation rules that apply to the request.
 | 
						|
     *
 | 
						|
     * @return array
 | 
						|
     */
 | 
						|
    public function rules()
 | 
						|
    {
 | 
						|
        $rules = [];
 | 
						|
        switch ($this->get('driver')) {
 | 
						|
            case 's3':
 | 
						|
                $rules = [
 | 
						|
                    'credentials.key' => [
 | 
						|
                        'required',
 | 
						|
                        'string',
 | 
						|
                    ],
 | 
						|
                    'credentials.secret' => [
 | 
						|
                        'required',
 | 
						|
                        'string',
 | 
						|
                    ],
 | 
						|
                    'credentials.region' => [
 | 
						|
                        'required',
 | 
						|
                        'string',
 | 
						|
                    ],
 | 
						|
                    'credentials.bucket' => [
 | 
						|
                        'required',
 | 
						|
                        'string',
 | 
						|
                    ],
 | 
						|
                    'credentials.root' => [
 | 
						|
                        'required',
 | 
						|
                        'string',
 | 
						|
                    ],
 | 
						|
                ];
 | 
						|
 | 
						|
                break;
 | 
						|
 | 
						|
            case 'doSpaces':
 | 
						|
                $rules = [
 | 
						|
                    'credentials.key' => [
 | 
						|
                        'required',
 | 
						|
                        'string',
 | 
						|
                    ],
 | 
						|
                    'credentials.secret' => [
 | 
						|
                        'required',
 | 
						|
                        'string',
 | 
						|
                    ],
 | 
						|
                    'credentials.region' => [
 | 
						|
                        'required',
 | 
						|
                        'string',
 | 
						|
                    ],
 | 
						|
                    'credentials.bucket' => [
 | 
						|
                        'required',
 | 
						|
                        'string',
 | 
						|
                    ],
 | 
						|
                    'credentials.endpoint' => [
 | 
						|
                        'required',
 | 
						|
                        'string',
 | 
						|
                    ],
 | 
						|
                    'credentials.root' => [
 | 
						|
                        'required',
 | 
						|
                        'string',
 | 
						|
                    ],
 | 
						|
                ];
 | 
						|
 | 
						|
                break;
 | 
						|
 | 
						|
            case 'dropbox':
 | 
						|
                $rules = [
 | 
						|
                    'credentials.token' => [
 | 
						|
                        'required',
 | 
						|
                        'string',
 | 
						|
                    ],
 | 
						|
                    'credentials.key' => [
 | 
						|
                        'required',
 | 
						|
                        'string',
 | 
						|
                    ],
 | 
						|
                    'credentials.secret' => [
 | 
						|
                        'required',
 | 
						|
                        'string',
 | 
						|
                    ],
 | 
						|
                    'credentials.app' => [
 | 
						|
                        'required',
 | 
						|
                        'string',
 | 
						|
                    ],
 | 
						|
                    'credentials.root' => [
 | 
						|
                        'required',
 | 
						|
                        'string',
 | 
						|
                    ],
 | 
						|
                ];
 | 
						|
 | 
						|
                break;
 | 
						|
        }
 | 
						|
 | 
						|
        $defaultRules = [
 | 
						|
            'name' => [
 | 
						|
                'required',
 | 
						|
            ],
 | 
						|
            'driver' => [
 | 
						|
                'required',
 | 
						|
            ],
 | 
						|
        ];
 | 
						|
 | 
						|
        return array_merge($rules, $defaultRules);
 | 
						|
    }
 | 
						|
}
 |