• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LeTraceurSnorkLibrary / MessSaga / 25921197134

15 May 2026 01:44PM UTC coverage: 41.107% (+4.5%) from 36.562%
25921197134

Pull #20

github

web-flow
Merge a78ef7498 into aac55fbb3
Pull Request #20: feat: tariffs

290 of 509 new or added lines in 31 files covered. (56.97%)

3 existing lines in 3 files now uncovered.

869 of 2114 relevant lines covered (41.11%)

0.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

31.25
/app/Models/User.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace App\Models;
6

7
// use Illuminate\Contracts\Auth\MustVerifyEmail;
8
use App\Enums\UserRoleEnum;
9
use App\Tariffs\Contracts\TariffInterface;
10
use App\Tariffs\TariffCatalog;
11
use Database\Factories\UserFactory;
12
use Filament\Models\Contracts\FilamentUser;
13
use Filament\Panel;
14
use Illuminate\Database\Eloquent\Factories\HasFactory;
15
use Illuminate\Database\Eloquent\Relations\HasMany;
16
use Illuminate\Foundation\Auth\User as Authenticatable;
17
use Illuminate\Notifications\Notifiable;
18

19
class User extends Authenticatable implements FilamentUser
20
{
21
    /**
22
     * @use HasFactory<UserFactory>
23
     */
24
    use HasFactory;
25
    use Notifiable;
26

27
    /**
28
     * The attributes that are mass assignable.
29
     *
30
     * @var list<string>
31
     */
32
    protected $fillable = [
33
        'name',
34
        'email',
35
        'password',
36
        'role',
37
        'tariff_code',
38
        'media_quota_grace_until',
39
        'media_cleanup_strategy',
40
        'encryption_salt',
41
    ];
42

43
    /**
44
     * The attributes that should be hidden for serialization.
45
     *
46
     * @var list<string>
47
     */
48
    protected $hidden = [
49
        'encryption_salt',
50
        'password',
51
        'remember_token',
52
    ];
53

54
    /**
55
     * @param string $role
56
     *
57
     * @return bool
58
     */
59
    public function hasRole(string $role): bool
60
    {
61
        return $this->role === $role;
6✔
62
    }
63

64
    /**
65
     * @param string $role
66
     *
67
     * @return self
68
     */
69
    public function assignRole(string $role): self
70
    {
71
        $this->role = $role;
1✔
72

73
        return $this;
1✔
74
    }
75

76
    /**
77
     * @param Panel $panel
78
     *
79
     * @return bool
80
     */
81
    public function canAccessPanel(Panel $panel): bool
82
    {
83
        return $this->hasRole(UserRoleEnum::ADMIN->value);
5✔
84
    }
85

86
    /**
87
     * @return HasMany<MessengerAccount, $this>
88
     */
89
    public function messengerAccounts(): HasMany
90
    {
91
        return $this->hasMany(MessengerAccount::class);
1✔
92
    }
93

94
    /**
95
     * @return TariffInterface
96
     */
97
    public function tariff(): TariffInterface
98
    {
NEW
99
        return TariffCatalog::forCode($this->tariff_code);
×
100
    }
101

102
    /**
103
     * Boot the model.
104
     *
105
     * @return void
106
     */
107
    protected static function boot(): void
108
    {
109
        parent::boot();
×
110

111
        static::creating(function (User $user): void {
×
112
            if (empty($user->encryption_salt)) {
×
113
                $user->encryption_salt = base64_encode(random_bytes(32));
×
114
            }
115
        });
×
116
    }
117

118
    /**
119
     * Get the attributes that should be cast.
120
     *
121
     * @return array<string, string>
122
     */
123
    protected function casts(): array
124
    {
125
        return [
×
NEW
126
            'email_verified_at'       => 'datetime',
×
NEW
127
            'media_quota_grace_until' => 'datetime',
×
NEW
128
            'password'                => 'hashed',
×
UNCOV
129
        ];
×
130
    }
131
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc