| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public function index() |
||
| 21 | { |
||
| 22 | // Cleanup lost orders all 5 minutes |
||
| 23 | if (!Cache::has('deletedLostOrders')) { |
||
| 24 | $expiresAt = now()->addMinutes(5); |
||
| 25 | Artisan::call('app:deleteLostOrders'); |
||
| 26 | Cache::put('deletedLostOrders', '1', $expiresAt); |
||
| 27 | } |
||
| 28 | |||
| 29 | $projects = Project::where('is_archived', 0)->with(['events' => function ($query) { |
||
| 30 | $query->where('customer_sell_stop', '>=', new \DateTime())->orderBy('start_date', 'ASC'); |
||
| 31 | }, 'events.location'])->get(); |
||
| 32 | |||
| 33 | $currentProjects = $projects->filter(function ($project) { |
||
| 34 | return $project->events->count() > 0; |
||
| 35 | })->all(); |
||
| 36 | |||
| 37 | return view('ticketshop.events', ['projects' => $currentProjects]); |
||
| 38 | } |
||
| 40 |