Issues (2)

src/Traits/FormStatus.php (1 issue)

1
<?php
2
3
namespace Sfneal\ViewModels\Traits;
4
5
trait FormStatus
6
{
7
    /**
8
     * Add success status to the view model.
9
     *
10
     * @return $this
11
     */
12
    public function withSuccess(): self
13
    {
14
        $this->withStatus('success');
15
16
        return $this;
17
    }
18
19
    /**
20
     * Add success status to the view model.
21
     *
22
     * @return $this
23
     */
24
    public function withFailure(): self
25
    {
26
        $this->withStatus('failure');
27
28
        return $this;
29
    }
30
31
    /**
32
     * Set a Client Inquiry success/failure status to be displayed in the view model.
33
     *
34
     * @param  string  $status
35
     * @return $this
36
     */
37
    private function withStatus(string $status): self
38
    {
39
        $this->status = $status;
0 ignored issues
show
Bug Best Practice introduced by
The property status does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
40
41
        return $this;
42
    }
43
}
44