phpvms/app/Http/Requests/CreateFareRequest.php

30 lines
564 B
PHP
Raw Normal View History

<?php
namespace App\Http\Requests;
use App\Models\Fare;
2018-02-21 12:33:09 +08:00
use Illuminate\Foundation\Http\FormRequest;
class CreateFareRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
* @return bool
*/
2018-03-22 01:35:06 +08:00
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
* @return array
*/
2018-03-22 01:35:06 +08:00
public function rules(): array
{
2018-03-22 01:35:06 +08:00
$rules = Fare::$rules;
$rules['code'] .= '|unique:fares';
return $rules;
}
}