| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | public static function insertRecentlyAdded(): void |
||
| 16 | { |
||
| 17 | $categories = Category::query()->with('parent')->where('r.adddate', '>', now()->subWeek())->select([ |
||
| 18 | 'root_categories_id', DB::raw('COUNT(r.id) as count'), 'title', |
||
| 19 | ])->join('releases as r', 'r.categories_id', '=', |
||
| 20 | 'categories.id')->groupBy('title')->orderByDesc('count')->get(); |
||
|
|
|||
| 21 | |||
| 22 | foreach ($categories as $category) { |
||
| 23 | self::updateOrCreate([ |
||
| 24 | 'category' => $category->title, |
||
| 25 | 'count' => $category->count, |
||
| 26 | ]); |
||
| 35 |