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
|
|
|
|
*/
|
|
|
|
class ImportRequest extends FormRequest
|
|
|
|
{
|
|
|
|
public static $rules = [
|
2018-08-27 00:40:04 +08:00
|
|
|
'csv_file' => 'required|file',
|
2018-03-23 06:17:37 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param Request $request
|
2018-08-27 00:40:04 +08:00
|
|
|
*
|
2018-03-23 06:17:37 +08:00
|
|
|
* @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;
|
|
|
|
}
|
|
|
|
}
|