Subversion-Projekte lars-tiefland.webanos.zeldi.de

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
4 lars 1
<?php
2
 
3
    namespace App\Models;
4
 
5
    // use Illuminate\Contracts\Auth\MustVerifyEmail;
6
    use Illuminate\Database\Eloquent\Factories\HasFactory;
7
    use Illuminate\Foundation\Auth\User as Authenticatable;
8
    use Illuminate\Notifications\Notifiable;
9
    use Laravel\Sanctum\HasApiTokens;
10
    use Illuminate\Database\Eloquent\Casts\Attribute;
11
 
12
    class User extends Authenticatable
13
    {
14
        use HasApiTokens, HasFactory, Notifiable;
15
 
16
        /**
17
         * The connection name for the model.
18
         *
19
         * @var string
20
         */
21
        protected $connection = 'order';
22
        /**
23
         * The attributes that are mass assignable.
24
         *
25
         * @var array<int, string>
26
         */
27
        protected $fillable = [
28
            'name',
29
            'email',
30
            'password',
31
            'google2fa_secret',
32
        ];
33
 
34
        /**
35
         * The attributes that should be hidden for serialization.
36
         *
37
         * @var array<int, string>
38
         */
39
        protected $hidden = [
40
            'password',
41
            'remember_token',
42
        ];
43
 
44
        /**
45
         * The attributes that should be cast.
46
         *
47
         * @var array<string, string>
48
         */
49
        protected $casts = [
50
            'email_verified_at' => 'datetime',
51
        ];
52
 
53
        /**
54
         * Interact with the user's first name.
55
         *
56
         * @param string $value
57
         * @return \Illuminate\Database\Eloquent\Casts\Attribute
58
         */
59
        protected function google2faSecret(): Attribute
60
        {
61
            return new Attribute(
62
                get: fn( $value ) => decrypt( $value ),
63
                set: fn( $value ) => encrypt( $value ),
64
            );
65
        }
66
    }