43 lines
900 B
PHP
43 lines
900 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rules\File;
|
|
|
|
|
|
class FileRequest extends FormRequest
|
|
{
|
|
public $filetoinsert;
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'filetoinsert' => ['required', 'mimes:csv']//, File::types(['csv'])]
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'filetoinsert.required' => 'ERROR: csv file not selected!',
|
|
'filetoinsert.mimes'=> "ERRORE: select only csv format"
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|