Skip to content

Commit 57fa7cc

Browse files
committed
Creation of notComplete() ticket scope
1 parent fec3f5c commit 57fa7cc

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/Models/Ticket.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function isNew()
9999
*/
100100
public function scopeActive($query)
101101
{
102-
$query = $query->whereNull('completed_at');
102+
$query = $query->notComplete();
103103

104104
if (is_null(auth()->user()) or \PanicHDMember::find(auth()->user()->id)->currentLevel() < 2) {
105105
return $query;
@@ -118,14 +118,24 @@ public function scopeComplete($query)
118118
return $query->whereNotNull('completed_at');
119119
}
120120

121+
/**
122+
* List of NOT completed tickets.
123+
*
124+
* @return Collection
125+
*/
126+
public function scopeNotComplete($query)
127+
{
128+
return $query->whereNull('completed_at');
129+
}
130+
121131
/**
122132
* List of new tickets (active with status "new").
123133
*
124134
* @return Collection
125135
*/
126136
public function scopeNewest($query)
127137
{
128-
return $query->whereNull('completed_at')->where('status_id', Setting::grab('default_status_id'));
138+
return $query->notComplete()->where('status_id', Setting::grab('default_status_id'));
129139
}
130140

131141
/**

0 commit comments

Comments
 (0)