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

Revision

Revision 2 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | 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;
118 lars 10
    use Illuminate\Database\Eloquent\Casts\Attribute;
2 lars 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',
118 lars 30
	    'password',
31
	    'google2fa_secret',
2 lars 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
        ];
118 lars 52
    /**
53
     * Interact with the user's first name.
54
     *
55
     * @param  string  $value
56
     * @return \Illuminate\Database\Eloquent\Casts\Attribute
57
     */
58
    protected function google2faSecret(): Attribute
59
    {
60
        return new Attribute(
61
            get: fn ($value) =>  decrypt($value),
62
            set: fn ($value) =>  encrypt($value),
63
        );
64
    }    }