Issues (215)

src/Model/User.php (2 issues)

1
<?php
2
3
namespace Siak\Tontine\Model;
4
5
use Illuminate\Database\Eloquent\Casts\Attribute;
6
7
class User extends \App\Models\User
8
{
9
    use Traits\HasProperty;
0 ignored issues
show
The trait Siak\Tontine\Model\Traits\HasProperty requires some properties which are not provided by Siak\Tontine\Model\User: $property, $content
Loading history...
10
11
    /**
12
     * Get the values of the properties.
13
     *
14
     * @return Attribute
15
     */
16
    protected function city(): Attribute
17
    {
18
        return Attribute::make(
19
            get: fn() => $this->profile ? $this->profile->city : '',
20
        );
21
    }
22
23
    /**
24
     * @return Attribute
25
     */
26
    protected function countryCode(): Attribute
27
    {
28
        return Attribute::make(
29
            get: fn() => $this->profile ? $this->profile->country_code : '',
30
        );
31
    }
32
33
    /**
34
     * @return Attribute
35
     */
36
    protected function locale(): Attribute
37
    {
38
        return Attribute::make(
39
            get: fn() => $this->properties['locale'] ?? 'fr',
0 ignored issues
show
The property properties does not seem to exist on Siak\Tontine\Model\User. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
40
        );
41
    }
42
43
    public function profile()
44
    {
45
        return $this->hasOne(Profile::class);
46
    }
47
48
    public function guilds()
49
    {
50
        return $this->hasMany(Guild::class)->orderBy('guilds.id', 'desc');
51
    }
52
53
    public function host_invites()
54
    {
55
        return $this->hasMany(GuestInvite::class, 'host_id');
56
    }
57
58
    public function guest_invites()
59
    {
60
        return $this->hasMany(GuestInvite::class, 'guest_id');
61
    }
62
}
63