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

LeTraceurSnorkLibrary / MessSaga / 24340325874

13 Apr 2026 11:12AM UTC coverage: 27.903% (-2.6%) from 30.539%
24340325874

Pull #18

github

web-flow
Merge 7a189b893 into 572b42cbd
Pull Request #18: feat: admin panel

0 of 144 new or added lines in 8 files covered. (0.0%)

1 existing line in 1 file now uncovered.

459 of 1645 relevant lines covered (27.9%)

0.65 hits per line

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

0.0
/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 Database\Factories\UserFactory;
10
use Filament\Models\Contracts\FilamentUser;
11
use Filament\Panel;
12
use Illuminate\Database\Eloquent\Factories\HasFactory;
13
use Illuminate\Database\Eloquent\Relations\HasMany;
14
use Illuminate\Foundation\Auth\User as Authenticatable;
15
use Illuminate\Notifications\Notifiable;
16

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

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

38
    /**
39
     * The attributes that should be hidden for serialization.
40
     *
41
     * @var list<string>
42
     */
43
    protected $hidden = [
44
        'encryption_salt',
45
        'password',
46
        'remember_token',
47
    ];
48

49
    /**
50
     * @param string $role
51
     *
52
     * @return bool
53
     */
54
    public function hasRole(string $role): bool
55
    {
NEW
56
        return $this->role === $role;
×
57
    }
58

59
    /**
60
     * @param Panel $panel
61
     *
62
     * @return bool
63
     */
64
    public function canAccessPanel(Panel $panel): bool
65
    {
NEW
66
        return $this->hasRole(UserRoleEnum::ADMIN->value);
×
67
    }
68

69
    /**
70
     * @return HasMany<MessengerAccount, $this>
71
     */
72
    public function messengerAccounts(): HasMany
73
    {
NEW
74
        return $this->hasMany(MessengerAccount::class);
×
75
    }
76

77
    /**
78
     * Boot the model.
79
     *
80
     * @return void
81
     */
82
    protected static function boot(): void
83
    {
84
        parent::boot();
×
85

86
        static::creating(function (User $user): void {
×
87
            if (empty($user->encryption_salt)) {
×
88
                $user->encryption_salt = base64_encode(random_bytes(32));
×
89
            }
90
        });
×
91
    }
92

93
    /**
94
     * Get the attributes that should be cast.
95
     *
96
     * @return array<string, string>
97
     */
98
    protected function casts(): array
99
    {
100
        return [
×
101
            'email_verified_at' => 'datetime',
×
102
            'password'          => 'hashed',
×
103
        ];
×
104
    }
105
}
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