phpvms/app/Http/Requests/ImportRequest.php

37 lines
703 B
PHP
Raw Normal View History

2018-03-23 06:17:37 +08:00
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Request;
/**
* Validate that the files are imported
* @package App\Http\Requests
*/
class ImportRequest extends FormRequest
{
public static $rules = [
'csv_file' => 'required|file',
];
/**
* @param Request $request
* @throws \Illuminate\Validation\ValidationException
*/
public static function validate(Request $request)
{
\Validator::make($request->all(), static::$rules)->validate();
}
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return static::$rules;
}
}