better management of shipping and basket summary display

This commit is contained in:
ludo
2023-12-03 00:40:47 +01:00
parent 4bcfc7bc6d
commit ec509df665
26 changed files with 317 additions and 477 deletions

View File

@@ -3,9 +3,12 @@
namespace App\Repositories\Shop;
use App\Models\Shop\Homepage;
use App\Traits\Model\Basic;
class Homepages
{
use Basic;
public static function getLast()
{
$model = Homepage::latest('id')->first();
@@ -28,34 +31,8 @@ class Homepages
return self::get(3)->text ?? '';
}
public static function get($id)
public static function getModel()
{
return Homepage::find($id);
}
public static function store($data)
{
$item = ($data['id'] ?? false) ? self::update($data) : self::create($data);
return $item->id;
}
public static function create($data)
{
return Homepage::create($data);
}
public static function update($data, $id = false)
{
$id = $id ? $id : $data['id'];
$item = self::get($id);
$item->update($data);
return $item;
}
public static function destroy($id)
{
return Homepage::destroy($id);
return Homepage::query();
}
}