forked from owen-it/laravel-auditing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUser.php
38 lines (31 loc) · 977 Bytes
/
User.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace OwenIt\Auditing\Tests\Models;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use OwenIt\Auditing\Contracts\Auditable;
use OwenIt\Auditing\Tests\database\factories\UserFactory;
class User extends Model implements Auditable, Authenticatable
{
use HasFactory;
use \Illuminate\Auth\Authenticatable;
use \OwenIt\Auditing\Auditable;
protected static string $factory = UserFactory::class;
/**
* {@inheritdoc}
*/
protected $casts = [
'is_admin' => 'bool',
];
/**
* Uppercase first name character accessor.
*/
public function getFirstNameAttribute(string $value): string
{
return ucfirst($value);
}
public function groups()
{
return $this->belongsToMany(Group::class, 'group_members', 'user_id', 'group_id')->using(GroupMember::class)->withPivot('id','role');
}
}