update 20.10.2025

This commit is contained in:
Kevin Adametz 2025-10-20 17:42:08 +02:00
parent 8c11130b5d
commit a939cd51ef
616 changed files with 84821 additions and 4121 deletions

View file

@ -0,0 +1,80 @@
<?php
namespace App\Services\SyS;
use Carbon;
use Request;
use App\Models\SySetting;
use App\Models\ProductBuying;
use App\Cron\BusinessUsersStore;
use App\Models\ShoppingOrderItem;
class BuyingsProducts
{
public static function show()
{
$data = [
];
return view('sys.tools.buyings_products', $data);
}
public static function store()
{
$ShoppingOrderItems = ShoppingOrderItem::where('product_id', 37)->get();
$count = 0;
foreach($ShoppingOrderItems as $ShoppingOrderItem){
if(!ProductBuying::where('user_id', $ShoppingOrderItem->shopping_order->auth_user_id)->where('product_id', $ShoppingOrderItem->product_id)->count()){
ProductBuying::create([
'user_id' => $ShoppingOrderItem->shopping_order->auth_user_id,
'product_id' => 37,
'amount' => 1
]);
$count ++;
}
}
dump("ADD ".$count." product_id 37");
$ShoppingOrderItems = ShoppingOrderItem::where('product_id', 100)->get();
$count = 0;
foreach($ShoppingOrderItems as $ShoppingOrderItem){
if(!ProductBuying::where('user_id', $ShoppingOrderItem->shopping_order->auth_user_id)->where('product_id', $ShoppingOrderItem->product_id)->count()){
ProductBuying::create([
'user_id' => $ShoppingOrderItem->shopping_order->auth_user_id,
'product_id' => 118,
'amount' => 1
]);
$count ++;
}
}
dump("ADD ".$count." product_id 100 to 118");
$ShoppingOrderItems = ShoppingOrderItem::where('product_id', 118)->get();
$count = 0;
foreach($ShoppingOrderItems as $ShoppingOrderItem){
if(!ProductBuying::where('user_id', $ShoppingOrderItem->shopping_order->auth_user_id)->where('product_id', $ShoppingOrderItem->product_id)->count()){
ProductBuying::create([
'user_id' => $ShoppingOrderItem->shopping_order->auth_user_id,
'product_id' => 118,
'amount' => 1
]);
$count ++;
}
}
dump("ADD ".$count." product_id 118");
die();
\Session()->flash('alert-save', '1');
return redirect(route('sysadmin_tool', ['buyings_products']));
}
}