Actualizacion de Diseño Logins y Parte de Registro Negocios

This commit is contained in:
kquiroz
2023-08-23 16:11:21 -04:00
parent d71e89adae
commit 38bf59042d
3498 changed files with 691264 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Services;
use App\Models\FlashDeal;
use App\Models\FlashDealProduct;
use App\Models\Product;
class ProductFlashDealService
{
public function store(array $data, Product $product)
{
$collection = collect($data);
if ($collection['flash_deal_id']) {
$flash_deal_product = FlashDealProduct::firstOrNew([
'flash_deal_id' => $collection['flash_deal_id'],
'product_id' => $product->id]
);
$flash_deal_product->flash_deal_id = $collection['flash_deal_id'];
$flash_deal_product->product_id = $product->id;
$flash_deal_product->save();
$flash_deal = FlashDeal::findOrFail($collection['flash_deal_id']);
$product->discount = $collection['flash_discount'];
$product->discount_type = $collection['flash_discount_type'];
$product->discount_start_date = $flash_deal->start_date;
$product->discount_end_date = $flash_deal->end_date;
$product->save();
}
}
}