restore composer.json, add mysqli extension

This commit is contained in:
2026-04-15 17:02:52 +05:00
commit 77cf56a348
4317 changed files with 1397107 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Jobs\Site\Checkout;
use App\Models\Address;
class AddressStoreJob
{
protected $request;
public function __construct($request)
{
$this->request = $request;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$phone_other = $this->request->address['other_phone'] ? str_replace(['+', '(', ')', ' ', '-'], '', $this->request->address['other_phone']) : null;
return Address::create([
'user_id' => auth()->user()->id,
'first_name' => !empty(auth()->user()->first_name) ? auth()->user()->first_name : 'NoName',
'phone_other' => $phone_other,
'phone' => auth()->user()->phone,
'city_id' => $this->request->address['city_id'],
'street' => $this->request->address['address'],
]);
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Jobs\Site\Checkout;
use App\Models\Billing;
class BillingStoreJob
{
protected $order;
protected $total;
protected $payment_system;
public function __construct($order, $total, $payment_system)
{
$this->order = $order;
$this->total = $total;
$this->payment_system = $payment_system;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
return Billing::create([
'order_id' => $this->order->id,
'amount' => $this->total,
'payment_system' => $this->payment_system
]);
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace App\Jobs\Site\Checkout;
use App\Models\Cart as CartModel;
use App\Models\OrderProducts;
use App\Models\Product;
use Illuminate\Support\Facades\Log;
class ProductsOrderStoreJob
{
protected $request;
protected $order;
/**
* ProductsOrderStoreJob constructor.
* @param $request
* @param $order
*/
public function __construct($request, $order)
{
$this->order = $order;
$this->request = $request;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
foreach ($this->request->products as $product) {
$cart = CartModel::where('id', $product)->first();
if (!empty($cart)) {
$discount = $cart->product->product->price_discount ? 100 - $cart->product->product->price_discount * 100 / $cart->product->product->price : null;
// if ($this->request->payment_type == 'cash') {
$product = Product::find($cart->product->product->id);
$product->count = $product->count - (int) $cart->count;
$product->save();
// }
OrderProducts::create([
'order_id' => $this->order->id,
'product_id' => $cart->product->product->id,
'discount' => round($discount),
'count' => $cart->count,
'size' => $cart->size,
'color_id' => $cart->product_id,
'price' => $cart->product->product->price_discount ? round($cart->product->product->price_discount, 0) : round($cart->product->product->price, 0)
]);
}
}
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace App\Jobs\Site\Checkout;
use App\Models\Order;
class StoreJob
{
protected $request;
protected $address;
protected $delivery_price;
protected $price_product;
protected $currency;
/**
* StoreJob constructor.
* @param $request
* @param $address
* @param $delivery_price
* @param $currency
* @param $product_total
*/
public function __construct($request, $address, $delivery_price, $currency, $product_total)
{
$this->request = $request;
$this->address = $address;
$this->delivery_price = $delivery_price;
$this->currency = $currency;
$this->price_product = $product_total;
}
/**
* @return mixed
*/
public function handle()
{
return Order::create([
'user_id' => auth()->user()->id,
'address_id' => $this->address === null ? null : $this->address->id,
'type_delivery' => $this->request->delivery_type,
'price_delivery' => $this->delivery_price,
'currency' => $this->currency,
'payment_type' => $this->request->payment_type,
'payment_status' => $this->request->getPaymentStatus(),
'comment' => $this->request->address['comment'],
'price_product' => $this->price_product
]);
}
}