UpdateAccount::update()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 9
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Xetaravel\Livewire\User;
6
7
use Illuminate\Contracts\View\Factory;
8
use Illuminate\Contracts\View\View;
9
use Illuminate\Foundation\Application;
10
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
11
use Livewire\Component;
12
use Livewire\WithFileUploads;
13
use Masmerise\Toaster\Toastable;
14
use Xetaravel\Livewire\Forms\AccountForm;
15
use Throwable;
16
17
class UpdateAccount extends Component
18
{
19
    use AuthorizesRequests;
20
    use Toastable;
21
    use WithFileUploads;
0 ignored issues
show
introduced by
The trait Livewire\WithFileUploads requires some properties which are not provided by Xetaravel\Livewire\User\UpdateAccount: $map, $timestamp
Loading history...
22
23
    /**
24
     * The form used to create/update a model.
25
     *
26
     * @var AccountForm
27
     */
28
    public AccountForm $form;
29
30
    public function mount(): void
31
    {
32
        $this->form->load();
33
    }
34
35
    public function render(): Factory|Application|View|\Illuminate\View\View
36
    {
37
        return view('livewire.user.update-account');
38
    }
39
40
    /**
41
     * Update the post.
42
     *
43
     * @throws Throwable
44
     */
45
    public function update()
46
    {
47
        $this->validate();
48
49
        $this->form->update();
50
51
        return redirect()
52
            ->route('user.account.index')
0 ignored issues
show
Bug introduced by
The method route() does not exist on Illuminate\Routing\Redirector. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

52
            ->/** @scrutinizer ignore-call */ route('user.account.index')

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
53
            ->success('Your account has been updated successfully !');
54
    }
55
}
56