remove unique on update #214

This commit is contained in:
Nabeel Shahzad
2018-03-21 12:35:06 -05:00
parent dad44db0bc
commit 95a7365fee
6 changed files with 29 additions and 23 deletions

View File

@@ -5,18 +5,29 @@ namespace App\Http\Requests;
use App\Models\Airport;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class CreateAirportRequest
* @package App\Http\Requests
*/
class CreateAirportRequest extends FormRequest
{
public function authorize()
/**
* Determine if the user is authorized to make this request.
* @return bool
*/
public function authorize(): bool
{
return true;
}
public function rules()
/**
* Get the validation rules that apply to the request.
* @return array
*/
public function rules(): array
{
$rules = Airport::$rules;
$rules['icao'] .= '|unique:airports';
return $rules;
}
}

View File

@@ -9,21 +9,21 @@ class CreateFareRequest 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 Fare::$rules;
$rules = Fare::$rules;
$rules['code'] .= '|unique:fares';
return $rules;
}
}

View File

@@ -9,21 +9,21 @@ class CreateSubfleetRequest 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 Subfleet::$rules;
$rules = Subfleet::$rules;
$rules['type'] .= '|unique:subfleets';
return $rules;
}
}

View File

@@ -9,24 +9,21 @@ class CreateUserRequest 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
{
$rules = User::$rules;
$rules['email'] .= '|unique:users,email';
return $rules;
}
}