Added fields to users table
This commit is contained in:
parent
b115ea9419
commit
64807fb96b
|
|
@ -20,7 +20,10 @@ class CreateNewUser implements CreatesNewUsers
|
||||||
public function create(array $input): User
|
public function create(array $input): User
|
||||||
{
|
{
|
||||||
Validator::make($input, [
|
Validator::make($input, [
|
||||||
'name' => ['required', 'string', 'max:255'],
|
'first_name' => ['required', 'string', 'max:255'],
|
||||||
|
'last_name' => ['required', 'string', 'max:255'],
|
||||||
|
'judging_preference' => ['required', 'string', 'max:255'],
|
||||||
|
'cell_phone' => ['required', 'string', 'max:255'],
|
||||||
'email' => [
|
'email' => [
|
||||||
'required',
|
'required',
|
||||||
'string',
|
'string',
|
||||||
|
|
@ -32,7 +35,10 @@ class CreateNewUser implements CreatesNewUsers
|
||||||
])->validate();
|
])->validate();
|
||||||
|
|
||||||
return User::create([
|
return User::create([
|
||||||
'name' => $input['name'],
|
'first_name' => $input['first_name'],
|
||||||
|
'last_name' => $input['last_name'],
|
||||||
|
'judging_preference' => $input['judging_preference'],
|
||||||
|
'cell_phone' => $input['cell_phone'],
|
||||||
'email' => $input['email'],
|
'email' => $input['email'],
|
||||||
'password' => Hash::make($input['password']),
|
'password' => Hash::make($input['password']),
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,10 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
|
||||||
public function update(User $user, array $input): void
|
public function update(User $user, array $input): void
|
||||||
{
|
{
|
||||||
Validator::make($input, [
|
Validator::make($input, [
|
||||||
'name' => ['required', 'string', 'max:255'],
|
'first_name' => ['required', 'string', 'max:255'],
|
||||||
|
'last_name' => ['required', 'string', 'max:255'],
|
||||||
|
'judging_preference' => ['required', 'string', 'max:255'],
|
||||||
|
'cell_phone' => ['required', 'string', 'max:255'],
|
||||||
|
|
||||||
'email' => [
|
'email' => [
|
||||||
'required',
|
'required',
|
||||||
|
|
@ -34,7 +37,10 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
|
||||||
$this->updateVerifiedUser($user, $input);
|
$this->updateVerifiedUser($user, $input);
|
||||||
} else {
|
} else {
|
||||||
$user->forceFill([
|
$user->forceFill([
|
||||||
'name' => $input['name'],
|
'first_name' => $input['first_name'],
|
||||||
|
'last_name' => $input['last_name'],
|
||||||
|
'judging_preference' => $input['judging_preference'],
|
||||||
|
'cell_phone' => $input['cell_phone'],
|
||||||
'email' => $input['email'],
|
'email' => $input['email'],
|
||||||
])->save();
|
])->save();
|
||||||
}
|
}
|
||||||
|
|
@ -48,7 +54,10 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
|
||||||
protected function updateVerifiedUser(User $user, array $input): void
|
protected function updateVerifiedUser(User $user, array $input): void
|
||||||
{
|
{
|
||||||
$user->forceFill([
|
$user->forceFill([
|
||||||
'name' => $input['name'],
|
'first_name' => $input['first_name'],
|
||||||
|
'last_ name' => $input['last_ name'],
|
||||||
|
'judging_preference' => $input['judging_preference'],
|
||||||
|
'cell_phone' => $input['cell_phone'],
|
||||||
'email' => $input['email'],
|
'email' => $input['email'],
|
||||||
'email_verified_at' => null,
|
'email_verified_at' => null,
|
||||||
])->save();
|
])->save();
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,10 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||||
* @var array<int, string>
|
* @var array<int, string>
|
||||||
*/
|
*/
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'first_name',
|
||||||
|
'last_name',
|
||||||
|
'judging_preference',
|
||||||
|
'cell_phone',
|
||||||
'email',
|
'email',
|
||||||
'password',
|
'password',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,10 @@ return new class extends Migration
|
||||||
{
|
{
|
||||||
Schema::create('users', function (Blueprint $table) {
|
Schema::create('users', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name');
|
$table->string('first_name');
|
||||||
|
$table->string('last_name');
|
||||||
|
$table->string('judging_preference')->nullable();
|
||||||
|
$table->string('cell_phone')->nullable();
|
||||||
$table->string('email')->unique();
|
$table->string('email')->unique();
|
||||||
$table->timestamp('email_verified_at')->nullable();
|
$table->timestamp('email_verified_at')->nullable();
|
||||||
$table->string('password');
|
$table->string('password');
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,13 @@
|
||||||
<div class="bg-white px-6 py-12 shadow sm:rounded-lg sm:px-12">
|
<div class="bg-white px-6 py-12 shadow sm:rounded-lg sm:px-12">
|
||||||
<form class="space-y-6" action="/register" method="POST">
|
<form class="space-y-6" action="/register" method="POST">
|
||||||
@csrf
|
@csrf
|
||||||
<x-auth.form-field name="name" label="Full Name" type="text" autocomplete="name" required />
|
<x-auth.form-field name="first_name" label="First Name" type="text" autocomplete="given-name" required />
|
||||||
|
<x-auth.form-field name="last_name" label="Last Name" type="text" autocomplete="family-name" required />
|
||||||
<x-auth.form-field name="email" label="Email address" type="email" autocomplete="email" required />
|
<x-auth.form-field name="email" label="Email address" type="email" autocomplete="email" required />
|
||||||
<x-auth.form-field name="password" label="Password" type="password" required />
|
<x-auth.form-field name="cell_phone" label="Cell Phone Number" type="tel" autocomplete="tel-national" />
|
||||||
<x-auth.form-field name="password_confirmation" label="Confirm Password" type="password" required />
|
<x-auth.form-field name="judging_preference" label="Judging Preference" type="text" />
|
||||||
|
<x-auth.form-field name="password" label="Password" type="password" autocomplete="new-password" required />
|
||||||
|
<x-auth.form-field name="password_confirmation" label="Confirm Password" autocomplete="new-password" type="password" required />
|
||||||
<x-auth.form-button>Create Account</x-auth.form-button>
|
<x-auth.form-button>Create Account</x-auth.form-button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
<form method="POST" action="/logout">
|
<form method="POST" action="/logout">
|
||||||
@csrf
|
@csrf
|
||||||
@auth
|
@auth
|
||||||
<p>Logged in as: {{ Auth::user()->name }}</p>
|
<p>Logged in as: {{ Auth::user()->first_name }}</p>
|
||||||
<x-auth.form-button>Logout</x-auth.form-button>
|
<x-auth.form-button>Logout</x-auth.form-button>
|
||||||
@endauth
|
@endauth
|
||||||
@guest()
|
@guest()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue