diff --git a/app/Account.php b/app/Account.php index 410ef92..934787b 100644 --- a/app/Account.php +++ b/app/Account.php @@ -27,6 +27,13 @@ class Account extends Authenticatable 'password', ]; + /** + * Indicates if the model should be timestamped. + * + * @var bool + */ + public $timestamps = false; + /* |------------------------------------------------------------------------------------ | Validations @@ -34,16 +41,17 @@ class Account extends Authenticatable */ public static function rules($update = false, $id = null) { - $commun = [ - 'email' => "required|email|unique:accounts,email,$id", + $rules = [ + 'email' => 'required|email|unique:accounts,email,' . $id, 'password' => 'nullable|confirmed' ]; if ($update) { - return $commun; + return $rules; } - return array_merge($commun, [ + return array_merge($rules, [ + 'name' => 'required|min:6|alphanum|unique:accounts', 'email' => 'required|email|max:255|unique:accounts', 'password' => 'required|confirmed|min:6', ]); diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/AccountController.php similarity index 100% rename from app/Http/Controllers/UserController.php rename to app/Http/Controllers/AccountController.php diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 7b0a0a3..8550ef3 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -27,7 +27,7 @@ class RegisterController extends Controller * * @var string */ - protected $redirectTo = '/home'; + protected $redirectTo = '/'; /** * Create a new controller instance. @@ -47,11 +47,7 @@ public function __construct() */ protected function validator(array $data) { - return Validator::make($data, [ - 'name' => 'required|string|max:255|unique:accounts', - 'email' => 'required|string|email|max:255|unique:accounts', - 'password' => 'required|string|min:6|confirmed', - ]); + return Validator::make($data, Account::rules()); } /** diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index ee96665..049694b 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -40,7 +40,7 @@
- + @if ($errors->has('password')) @@ -59,7 +59,7 @@