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
|
||||
{
|
||||
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' => [
|
||||
'required',
|
||||
'string',
|
||||
|
|
@ -32,7 +35,10 @@ class CreateNewUser implements CreatesNewUsers
|
|||
])->validate();
|
||||
|
||||
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'],
|
||||
'password' => Hash::make($input['password']),
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,10 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
|
|||
public function update(User $user, array $input): void
|
||||
{
|
||||
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' => [
|
||||
'required',
|
||||
|
|
@ -34,7 +37,10 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
|
|||
$this->updateVerifiedUser($user, $input);
|
||||
} else {
|
||||
$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'],
|
||||
])->save();
|
||||
}
|
||||
|
|
@ -48,7 +54,10 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
|
|||
protected function updateVerifiedUser(User $user, array $input): void
|
||||
{
|
||||
$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_verified_at' => null,
|
||||
])->save();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,10 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'first_name',
|
||||
'last_name',
|
||||
'judging_preference',
|
||||
'cell_phone',
|
||||
'email',
|
||||
'password',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -13,7 +13,10 @@ return new class extends Migration
|
|||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$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->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
|
|
|
|||
|
|
@ -4,10 +4,13 @@
|
|||
<div class="bg-white px-6 py-12 shadow sm:rounded-lg sm:px-12">
|
||||
<form class="space-y-6" action="/register" method="POST">
|
||||
@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="password" label="Password" type="password" required />
|
||||
<x-auth.form-field name="password_confirmation" label="Confirm 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="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>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<form method="POST" action="/logout">
|
||||
@csrf
|
||||
@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>
|
||||
@endauth
|
||||
@guest()
|
||||
|
|
|
|||
Loading…
Reference in New Issue