|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Uccello\Core\Models; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes; |
|
|
|
|
|
|
6
|
|
|
use Spatie\Searchable\Searchable; |
|
|
|
|
|
|
7
|
|
|
use Spatie\Searchable\SearchResult; |
|
|
|
|
|
|
8
|
|
|
use Uccello\Core\Database\Eloquent\Model; |
|
9
|
|
|
use Uccello\Core\Support\Traits\UccelloModule; |
|
10
|
|
|
|
|
11
|
|
|
class Role extends Model implements Searchable |
|
12
|
|
|
{ |
|
13
|
|
|
use SoftDeletes; |
|
14
|
|
|
use UccelloModule; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* The table associated with the model. |
|
18
|
|
|
* |
|
19
|
|
|
* @var string |
|
20
|
|
|
*/ |
|
21
|
|
|
protected $table = 'roles'; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* The attributes that should be mutated to dates. |
|
25
|
|
|
* |
|
26
|
|
|
* @var array |
|
27
|
|
|
*/ |
|
28
|
|
|
protected $dates = [ 'deleted_at' ]; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* The attributes that are mass assignable. |
|
32
|
|
|
* |
|
33
|
|
|
* @var array |
|
34
|
|
|
*/ |
|
35
|
|
|
protected $fillable = [ |
|
36
|
|
|
'name', |
|
37
|
|
|
'description', |
|
38
|
|
|
'parent_id', |
|
39
|
|
|
'domain_id' |
|
40
|
|
|
]; |
|
41
|
|
|
|
|
42
|
|
|
public $searchableType = 'role'; |
|
43
|
|
|
|
|
44
|
|
|
public $searchableColumns = [ |
|
45
|
|
|
'name' |
|
46
|
|
|
]; |
|
47
|
|
|
|
|
48
|
|
|
public function getSearchResult(): SearchResult |
|
49
|
|
|
{ |
|
50
|
|
|
return new SearchResult( |
|
51
|
|
|
$this, |
|
52
|
|
|
$this->recordLabel |
|
53
|
|
|
); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
protected function initTablePrefix() |
|
57
|
|
|
{ |
|
58
|
|
|
$this->tablePrefix = env('UCCELLO_TABLE_PREFIX', 'uccello_'); |
|
|
|
|
|
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function parent() |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->belongsTo(static::class); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function children() |
|
67
|
|
|
{ |
|
68
|
|
|
return $this->hasMany(static::class); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function domain() |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->belongsTo(Domain::class); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
public function privileges() |
|
77
|
|
|
{ |
|
78
|
|
|
return $this->hasMany(Privilege::class); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
public function profiles() |
|
82
|
|
|
{ |
|
83
|
|
|
return $this->belongsToMany(Profile::class, $this->tablePrefix.'profiles_roles'); |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
public function users() |
|
87
|
|
|
{ |
|
88
|
|
|
return $this->belongsToMany(User::class, 'uccello_privileges'); |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* Returns record label |
|
93
|
|
|
* |
|
94
|
|
|
* @return string |
|
95
|
|
|
*/ |
|
96
|
|
|
public function getRecordLabelAttribute() : string |
|
97
|
|
|
{ |
|
98
|
|
|
return $this->name; |
|
99
|
|
|
} |
|
100
|
|
|
} |
|
101
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths