Mail::store()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 3
1
<?php
2
3
namespace App\Models;
4
5
/**
6
 * Class Mail.
7
 */
8
class Mail extends ChocolateyModel
9
{
10
    /**
11
     * The table associated with the model.
12
     *
13
     * @var string
14
     */
15
    protected $table = 'chocolatey_users_mail_requests';
16
17
    /**
18
     * Primary Key of the Table.
19
     *
20
     * @var string
21
     */
22
    protected $primaryKey = 'id';
23
24
    /**
25
     * The attributes that are mass assignable.
26
     *
27
     * @var array
28
     */
29
    protected $fillable = ['used'];
30
31
    /**
32
     * Store a Mail Request.
33
     *
34
     * @param string $token
35
     * @param string $link
36
     * @param string $userMail
37
     *
38
     * @return Mail
39
     */
40
    public function store(string $token, string $link, string $userMail): Mail
41
    {
42
        $this->attributes['token'] = $token;
43
        $this->attributes['link'] = $link;
44
        $this->attributes['mail'] = $userMail;
45
46
        $this->save();
47
48
        return $this;
49
    }
50
}
51