Subversion-Projekte lars-tiefland.webanos.marine-sales.de

Revision

Zur aktuellen Revision | Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 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 attributes that are mass assignable.
18
         *
19
         * @var array<int, string>
20
         */
21
        protected $fillable = [
22
            'name',
23
            'email',
24
            'password',
25
            'google2fa_secret',
26
        ];
27
 
28
        /**
29
         * The attributes that should be hidden for serialization.
30
         *
31
         * @var array<int, string>
32
         */
33
        protected $hidden = [
34
            'password',
35
            'remember_token',
36
        ];
37
 
38
        /**
39
         * The attributes that should be cast.
40
         *
41
         * @var array<string, string>
42
         */
43
        protected $casts = [
44
            'email_verified_at' => 'datetime',
45
        ];
46
 
47
        /**
48
         * Interact with the user's first name.
49
         *
50
         * @param string $value
51
         * @return \Illuminate\Database\Eloquent\Casts\Attribute
52
         */
53
        protected function google2faSecret(): Attribute
54
        {
55
            return new Attribute(
56
                get: fn( $value ) => decrypt( $value ),
57
                set: fn( $value ) => encrypt( $value ),
58
            );
59
        }
60
    }