1 | <?php |
||
51 | class Tag extends ModelAbstract |
||
52 | { |
||
53 | use TagRelations, TagScopes, LoggedUser; |
||
54 | |||
55 | /** |
||
56 | * Core tag: Open. |
||
57 | * |
||
58 | * @var string |
||
59 | */ |
||
60 | const STATUS_OPEN = 'open'; |
||
61 | |||
62 | /** |
||
63 | * Core tag: Closed. |
||
64 | * |
||
65 | * @var string |
||
66 | */ |
||
67 | const STATUS_CLOSED = 'closed'; |
||
68 | |||
69 | /** |
||
70 | * Core tag group: Status. |
||
71 | * |
||
72 | * @var string |
||
73 | */ |
||
74 | const GROUP_STATUS = 'status'; |
||
75 | |||
76 | /** |
||
77 | * Core tag group: Type. |
||
78 | * |
||
79 | * @var string |
||
80 | */ |
||
81 | const GROUP_TYPE = 'type'; |
||
82 | |||
83 | /** |
||
84 | * Core tag group: Resolution. |
||
85 | * |
||
86 | * @var string |
||
87 | */ |
||
88 | const GROUP_RESOLUTION = 'resolution'; |
||
89 | |||
90 | /** |
||
91 | * Timestamp enabled. |
||
92 | * |
||
93 | * @var bool |
||
94 | */ |
||
95 | public $timestamps = true; |
||
96 | |||
97 | /** |
||
98 | * List of allowed columns to be used in $this->fill(). |
||
99 | * |
||
100 | * @var array |
||
101 | */ |
||
102 | public $fillable = ['parent_id', 'name', 'bgcolor', 'group', 'role_limit', 'message_limit', 'readonly']; |
||
103 | |||
104 | /** |
||
105 | * Name of database table. |
||
106 | * |
||
107 | * @var string |
||
108 | */ |
||
109 | protected $table = 'tags'; |
||
110 | |||
111 | /** |
||
112 | * @param User|null $user |
||
113 | * |
||
114 | * @return \Tinyissue\Repository\Tag\Updater |
||
115 | */ |
||
116 | public function updater(User $user = null) |
||
120 | |||
121 | /** |
||
122 | * Generate a URL for the tag. |
||
123 | * |
||
124 | * @param string $url |
||
125 | * |
||
126 | * @return mixed |
||
127 | */ |
||
128 | public function to($url) |
||
132 | |||
133 | /** |
||
134 | * Returns tag full name with prefix group name and ":" in between. |
||
135 | * |
||
136 | * @return string |
||
137 | */ |
||
138 | public function getFullNameAttribute() |
||
142 | |||
143 | /** |
||
144 | * Whether or not the current user can view this tag. |
||
145 | * |
||
146 | * @return bool |
||
147 | */ |
||
148 | public function canView() |
||
152 | |||
153 | /** |
||
154 | * Whether or not the tag to mark issue as ready only. |
||
155 | * |
||
156 | * @param User $user |
||
157 | * |
||
158 | * @return bool |
||
159 | */ |
||
160 | public function isReadOnly(User $user = null) |
||
168 | |||
169 | /** |
||
170 | * Return an array of tag details. |
||
171 | * |
||
172 | * @return array |
||
173 | */ |
||
174 | public function toShortArray() |
||
184 | |||
185 | /** |
||
186 | * Returns an array of core groups. |
||
187 | * |
||
188 | * @return array |
||
189 | */ |
||
190 | public static function getCoreGroups() |
||
198 | |||
199 | /** |
||
200 | * Whether or not the user is allowed to receive messages that contains the current tag. |
||
201 | * |
||
202 | * @param User $user |
||
203 | * |
||
204 | * @return bool |
||
205 | */ |
||
206 | public function allowMessagesToUser(User $user) |
||
214 | } |
||
215 |