Skip to content

Commit e127a70

Browse files
committed
adding archived and unarchived scopes to the ticket model
1 parent 90d86cc commit e127a70

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Scopes/TicketScope.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,20 @@ public function scopeWithHighPriority(Builder $builder): Builder
8787
{
8888
return $builder->where('priority', Priority::HIGH->value);
8989
}
90+
91+
/**
92+
* Get archived tickets
93+
*/
94+
public function scopeArchived(Builder $builder): Builder
95+
{
96+
return $builder->where('status', Status::ARCHIVED->value);
97+
}
98+
99+
/**
100+
* Get unarchived tickets
101+
*/
102+
public function scopeUnArchived(Builder $builder): Builder
103+
{
104+
return $builder->whereNot('status', Status::ARCHIVED->value);
105+
}
90106
}

0 commit comments

Comments
 (0)