add new metrics, graph metrics, prepare basket to storage

This commit is contained in:
ludo
2024-01-29 23:44:49 +01:00
parent 9fcc81f4d9
commit 53ad10eefa
12 changed files with 219 additions and 214 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Repositories\Shop;
use App\Models\Shop\Basket;
use Darryldecode\Cart\CartCollection;
class BasketStores
{
public function has($key)
{
return Basket::find($key);
}
public function get($key)
{
if($this->has($key))
{
return new CartCollection(Basket::find($key)->cart_data);
}
else
{
return [];
}
}
public function put($key, $value)
{
if($row = Basket::find($key))
{
// update
$row->cart_data = $value;
$row->save();
}
else
{
Basket::create([
'id' => $key,
'cart_data' => $value
]);
}
}
}