mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 10:10:48 +01:00
24 lines
690 B
PHP
24 lines
690 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
class SaleController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
$sales = Cache::remember('sales_data', 60 * 60 * 8, static function () {
|
|
$shopData = json_decode(
|
|
file_get_contents('https://api.shop.riotgames.com/v3/collections/'),
|
|
true
|
|
);
|
|
$salesData = array_filter($shopData, static fn ($collection) => $collection['path'] === '/event/sales');
|
|
|
|
return reset($salesData)['dynamicCollection']['discountedProductsByProductType'] ?? [];
|
|
});
|
|
|
|
return view('sales.index', ['sales' => $sales]);
|
|
}
|
|
}
|