Total Complexity | 4 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
8 | trait Publishable |
||
9 | { |
||
10 | /** |
||
11 | * Determine whether this article is published |
||
12 | * |
||
13 | * @return bool |
||
14 | */ |
||
15 | 6 | public function isPublished(): bool |
|
18 | } |
||
19 | |||
20 | /** |
||
21 | * Return all published models |
||
22 | * |
||
23 | * @return Collection |
||
24 | */ |
||
25 | 4 | public static function published(): Collection |
|
26 | { |
||
27 | 4 | return self::all() |
|
28 | 4 | ->filter(function ($model) { |
|
29 | 4 | return $model->isPublished(); |
|
30 | 4 | }) |
|
31 | 4 | ->values(); |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * Determine whether this article is scheduled |
||
36 | * |
||
37 | * @return bool |
||
38 | */ |
||
39 | 5 | public function isScheduled(): bool |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * Return all scheduled models |
||
46 | * |
||
47 | * @return Collection |
||
48 | */ |
||
49 | 1 | public static function scheduled(): Collection |
|
56 | } |
||
57 | } |
||
58 |