| @@ -232,8 +232,20 @@ | ||
| 232 | 232 | $boardQuery->excludeTemplates(); |
| 233 | 233 | }); |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | + /** | |
| 237 | + * Limit tasks to active, non-template boards available in this install. | |
| 238 | + */ | |
| 239 | + public function scopeOnActiveAvailableBoards($query) | |
| 240 | + { | |
| 241 | + return $query->whereHas('board', function ($boardQuery) { | |
| 242 | + $boardQuery->whereNull('archived_at') | |
| 243 | + ->excludeTemplates() | |
| 244 | + ->availableInCurrentInstall(); | |
| 245 | + }); | |
| 246 | + } | |
| 247 | + | |
| 236 | 248 | public function assignees() |
| 237 | 249 | { |
| 238 | 250 | return $this->belongsToMany( |
| 239 | 251 | User::class, |
| @@ -260,8 +272,13 @@ | ||
| 260 | 272 | } |
| 261 | 273 | |
| 262 | 274 | public function attachments() //may not need in future |
| 263 | 275 | { |
| 276 | + if (!defined('FLUENT_BOARDS_PRO_VERSION')) { | |
| 277 | + return $this->hasMany(Attachment::class, 'id', 'id') | |
| 278 | + ->where('id', 0); | |
| 279 | + } | |
| 280 | + | |
| 264 | 281 | return $this->hasMany(TaskAttachment::class, |
| 265 | 282 | 'object_id', 'id') |
| 266 | 283 | ->where('object_type', Constant::OBJECT_TYPE_TASK); |
| 267 | 284 | } |