1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Models\Access\Role; |
4
|
|
|
|
5
|
|
|
use App\Models\Access\Role\Traits\Attribute\RoleAttribute; |
6
|
|
|
use App\Models\Access\Role\Traits\Relationship\RoleRelationship; |
7
|
|
|
use App\Models\Access\Role\Traits\RoleAccess; |
8
|
|
|
use App\Models\Access\Role\Traits\Scope\RoleScope; |
9
|
|
|
use Illuminate\Database\Eloquent\Model; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* App\Models\Access\Role\Role |
13
|
|
|
* |
14
|
|
|
* @property int $id |
15
|
|
|
* @property string $name |
16
|
|
|
* @property string|null $display_name |
17
|
|
|
* @property int $all |
18
|
|
|
* @property int $sort |
19
|
|
|
* @property \Carbon\Carbon|null $created_at |
20
|
|
|
* @property \Carbon\Carbon|null $updated_at |
21
|
|
|
* @property-read string $action_buttons |
22
|
|
|
* @property-read string $delete_button |
23
|
|
|
* @property-read string $edit_button |
24
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Access\Permission\Permission[] $permissions |
25
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Access\User\User[] $users |
26
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Access\Role\Role sort($direction = 'asc') |
27
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Access\Role\Role whereAll($value) |
28
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Access\Role\Role whereCreatedAt($value) |
29
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Access\Role\Role whereDisplayName($value) |
30
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Access\Role\Role whereId($value) |
31
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Access\Role\Role whereName($value) |
32
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Access\Role\Role whereSort($value) |
33
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Access\Role\Role whereUpdatedAt($value) |
34
|
|
|
* @mixin \Eloquent |
35
|
|
|
*/ |
36
|
|
|
class Role extends Model |
37
|
|
|
{ |
38
|
|
|
use RoleScope, RoleAccess, RoleAttribute, RoleRelationship; |
39
|
|
|
/** |
40
|
|
|
* The database table used by the model |
41
|
|
|
* |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
protected $table; |
45
|
|
|
/** |
46
|
|
|
* The attributes that are mass assignable |
47
|
|
|
* |
48
|
|
|
* @var array |
49
|
|
|
*/ |
50
|
|
|
protected $fillable = ['name', 'display_name', 'all', 'sort']; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param array $attributes |
54
|
|
|
*/ |
55
|
|
|
public function __construct(array $attributes = []) |
56
|
|
|
{ |
57
|
|
|
parent::__construct($attributes); |
58
|
|
|
$this->table = config('access.roles_table'); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|