2024-10-22 20:29:54 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
use App\Models\Portfolio;
|
|
|
|
|
use App\Models\User;
|
|
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
|
use Livewire\Attributes\Rule;
|
|
|
|
|
use Livewire\Volt\Component;
|
|
|
|
|
|
|
|
|
|
new class extends Component {
|
|
|
|
|
|
|
|
|
|
// props
|
|
|
|
|
public Portfolio $portfolio;
|
|
|
|
|
public User $user;
|
|
|
|
|
|
2024-10-29 12:38:15 -05:00
|
|
|
#[Rule('required|string')]
|
|
|
|
|
public string $name;
|
|
|
|
|
|
2024-10-24 17:20:55 -05:00
|
|
|
#[Rule('required|string|min:8|confirmed')]
|
2024-10-22 20:29:54 -05:00
|
|
|
public string $password;
|
|
|
|
|
|
|
|
|
|
#[Rule('required|string')]
|
|
|
|
|
public string $password_confirmation;
|
|
|
|
|
|
|
|
|
|
// methods
|
2024-10-29 12:38:15 -05:00
|
|
|
public function mount()
|
|
|
|
|
{
|
|
|
|
|
$this->name = $this->user->name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function updateUserInformation()
|
2024-10-22 20:29:54 -05:00
|
|
|
{
|
2024-10-24 17:20:55 -05:00
|
|
|
|
2024-10-22 20:29:54 -05:00
|
|
|
$this->validate();
|
|
|
|
|
|
2024-10-29 12:38:15 -05:00
|
|
|
$this->user->name = $this->name;
|
2024-10-22 20:29:54 -05:00
|
|
|
$this->user->password = Hash::make($this->password);
|
2024-10-25 22:14:36 -05:00
|
|
|
$this->user->email_verified_at = now();
|
2024-10-22 20:29:54 -05:00
|
|
|
$this->user->save();
|
|
|
|
|
|
|
|
|
|
Auth::login($this->user, true);
|
|
|
|
|
|
|
|
|
|
return redirect(route('portfolio.show', ['portfolio' => $this->portfolio->id]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}; ?>
|
|
|
|
|
|
2024-10-29 12:38:15 -05:00
|
|
|
<x-form wire:submit="updateUserInformation" class="">
|
|
|
|
|
|
|
|
|
|
<div class="mt-2">
|
|
|
|
|
|
|
|
|
|
<x-input wire:model="name" label="{{ __('Name') }}" class="block mt-1 w-full" required autofocus />
|
|
|
|
|
</div>
|
2024-10-22 20:29:54 -05:00
|
|
|
|
|
|
|
|
<div class="mt-2">
|
|
|
|
|
|
2024-10-29 12:38:15 -05:00
|
|
|
<x-input wire:model="password" label="{{ __('Password') }}" class="block mt-1 w-full" type="password" required autocomplete="new-password" />
|
2024-10-22 20:29:54 -05:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="mt-2">
|
|
|
|
|
|
|
|
|
|
<x-input wire:model="password_confirmation" label="{{ __('Confirm Password') }}" class="block mt-1 w-full" type="password" required autocomplete="new-password" />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="flex items-center justify-end mt-2">
|
|
|
|
|
|
|
|
|
|
<x-button class="btn-primary" type="submit">
|
2024-10-29 12:38:15 -05:00
|
|
|
{{ __('Get Started') }}
|
2024-10-22 20:29:54 -05:00
|
|
|
</x-button>
|
|
|
|
|
</div>
|
|
|
|
|
</x-form>
|