2018-03-23 06:17:37 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
|
2020-03-29 01:03:52 +08:00
|
|
|
use App\Contracts\FormRequest;
|
2018-03-23 06:17:37 +08:00
|
|
|
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 rules(): array
|
|
|
|
{
|
|
|
|
return static::$rules;
|
|
|
|
}
|
|
|
|
}
|