Import/export expenses #194
This commit is contained in:
@@ -9,21 +9,21 @@ class CreateAircraftRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
return Aircraft::$rules;
|
||||
$rules = Aircraft::$rules;
|
||||
$rules['registration'] .= '|unique:aircraft';
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
|
||||
36
app/Http/Requests/ImportRequest.php
Normal file
36
app/Http/Requests/ImportRequest.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user