Organize requests differently.

This commit is contained in:
Taylor Otwell
2014-11-25 09:20:26 -06:00
parent 634c96d8d9
commit d306965007
6 changed files with 130 additions and 22 deletions

View File

@@ -0,0 +1,29 @@
<?php namespace App\Http\Requests\Auth;
use App\Http\Requests\Request;
class EmailPasswordLinkRequest extends Request {
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required',
];
}
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
}

View File

@@ -0,0 +1,29 @@
<?php namespace App\Http\Requests\Auth;
use App\Http\Requests\Request;
class LoginRequest extends Request {
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required', 'password' => 'required',
];
}
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
}

View File

@@ -0,0 +1,31 @@
<?php namespace App\Http\Requests\Auth;
use App\Http\Requests\Request;
class RegisterRequest extends Request {
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|min:6|confirmed',
];
}
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
}

View File

@@ -0,0 +1,31 @@
<?php namespace App\Http\Requests\Auth;
use App\Http\Requests\Request;
class ResetPasswordRequest extends Request {
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'token' => 'required',
'email' => 'required',
'password' => 'required|confirmed',
];
}
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
}