Test Failed
Push — master ( 27dc48...91c9bc )
by Maximo
02:29
created

library/Models/Users.php (1 issue)

1
<?php
0 ignored issues
show
End of line character is invalid; expected "\n" but found "\r\n"
Loading history...
2
declare(strict_types=1);
3
4
namespace Gewaer\Models;
5
6
use Gewaer\Traits\PermissionsTrait;
7
8
class Users extends \Baka\Auth\Models\Users
9
{
10
    use PermissionsTrait;
11
12
    /**
13
     * Initialize method for model.
14
     */
15 5
    public function initialize()
16
    {
17 5
        parent::initialize();
18
19 5
        $this->setSource('users');
20
21 5
        $this->hasOne(
22 5
            'id',
23 5
            'Gewaer\Models\UserRoles',
24 5
            'users_id',
25 5
            ['alias' => 'permission']
26
        );
27
28 5
        $this->hasMany(
29 5
            'id',
30 5
            'Gewaer\Models\UserRoles',
31 5
            'users_id',
32 5
            ['alias' => 'permissions']
33
        );
34 5
    }
35
36
    /**
37
     * Returns table name mapped in the model.
38
     *
39
     * @return string
40
     */
41 4
    public function getSource(): string
42
    {
43 4
        return 'users';
44
    }
45
46
    /**
47
     * Get the User key for redis
48
     *
49
     * @return string
50
     */
51
    public function getKey(): string
52
    {
53
        return $this->id;
54
    }
55
}
56