Eshop-Laravel/app/Http/Requests/SignupRequest.php

40 lines
1 KiB
PHP
Raw Normal View History

2019-10-18 09:25:37 +00:00
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class SignupRequest extends FormRequest
{
public function authorize()
{
return true;
}
public function rules()
{
return [
'name' => 'required|min:2',
'last_name' => 'required|min:2',
'streetNum' => 'required|numeric',
'street' => 'required|string',
'city' => 'required|string',
'ZIP' => 'required|numeric',
'country' => 'required|string|min:2',
'phone' => 'required|min:8|max:10',
'email' => 'required|email|unique:users,email',
'password' => 'required|min:6|max:10|confirmed',
];
}
public function messages(){ //if i want to change the errors mgs!
return [
'password.min' => 'password needs to be Between 6-10 chars',
'password.max' => 'password needs to be Between 6-10 chars',
'phone.numeric' => 'phone must be only numbers , without spaciel chars',
];
}
}