Import/export expenses #194

This commit is contained in:
Nabeel Shahzad
2018-03-22 17:17:37 -05:00
parent 4e3a9fd9ea
commit a44204b185
32 changed files with 613 additions and 139 deletions

View File

@@ -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;
}
}

View 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;
}
}