| Conditions | 2 |
| Paths | 1 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public static function findSpecialArticle(string $specialArticle): Article |
||
| 31 | { |
||
| 32 | return Cache::rememberForever( |
||
| 33 | "article.specialArticle.{$specialArticle}", |
||
| 34 | function () use ($specialArticle) { |
||
| 35 | $article = Article::where('technical_name', $specialArticle)->first(); |
||
| 36 | |||
| 37 | if (! $article) { |
||
| 38 | throw new Exception("There is no article with technical_name `{$specialArticle}`"); |
||
| 39 | } |
||
| 40 | |||
| 41 | return $article; |
||
| 42 | } |
||
| 43 | ); |
||
| 44 | } |
||
| 45 | } |
||
| 46 |