Actualizacuion de Rama Kquiroz

This commit is contained in:
ellecio2
2023-09-04 19:53:37 -04:00
parent d2e9ba53ab
commit 2e99d7b290
2206 changed files with 100145 additions and 467275 deletions

View File

@@ -126,7 +126,7 @@ class AddressController extends Controller
$address->delete();
return back();
}
flash(translate('Default address can not be deleted'))->warning();
flash(translate('Default address cannot be deleted'))->warning();
return back();
}

View File

@@ -145,6 +145,7 @@ class AizUploadController extends Controller
// Get the MIME type of the file
$file_mime = finfo_file($finfo, base_path('public/') . $path);
if ($type[$extension] == 'image' && get_setting('disable_image_optimization') != 1) {
try {
@@ -168,8 +169,9 @@ class AizUploadController extends Controller
}
}
if (env('FILESYSTEM_DRIVER') == 's3') {
Storage::disk('s3')->put(
if (env('FILESYSTEM_DRIVER') != 'local') {
Storage::disk(env('FILESYSTEM_DRIVER'))->put(
$path,
file_get_contents(base_path('public/') . $path),
[
@@ -177,6 +179,7 @@ class AizUploadController extends Controller
'ContentType' => $extension == 'svg' ? 'image/svg+xml' : $file_mime
]
);
// dd($storage);
if ($arr[0] != 'updates') {
unlink(base_path('public/') . $path);
}
@@ -230,8 +233,8 @@ class AizUploadController extends Controller
return back();
}
try {
if (env('FILESYSTEM_DRIVER') == 's3') {
Storage::disk('s3')->delete($upload->file_name);
if (env('FILESYSTEM_DRIVER') != 'local') {
Storage::disk(env('FILESYSTEM_DRIVER'))->delete($upload->file_name);
if (file_exists(public_path() . '/' . $upload->file_name)) {
unlink(public_path() . '/' . $upload->file_name);
}
@@ -281,8 +284,8 @@ class AizUploadController extends Controller
$uploads = Upload::all();
foreach ($uploads as $upload) {
try {
if (env('FILESYSTEM_DRIVER') == 's3') {
Storage::disk('s3')->delete($upload->file_name);
if (env('FILESYSTEM_DRIVER') != 'local') {
Storage::disk(env('FILESYSTEM_DRIVER'))->delete($upload->file_name);
if (file_exists(public_path() . '/' . $upload->file_name)) {
unlink(public_path() . '/' . $upload->file_name);
}

View File

@@ -3,11 +3,14 @@
namespace App\Http\Controllers\Api\V2;
use App\Http\Controllers\Controller;
use App\Http\Resources\V2\Auction\AuctionBidProducts;
use App\Http\Resources\V2\Auction\AuctionPurchaseHistory;
use App\Http\Resources\V2\AuctionMiniCollection;
use App\Http\Resources\V2\AuctionProductDetailCollection;
use App\Http\Resources\V2\ProductMiniCollection;
use App\Models\AuctionProductBid;
use App\Models\Product;
use Request;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class AuctionProductController extends Controller
@@ -15,7 +18,6 @@ class AuctionProductController extends Controller
public function index()
{
$products = Product::latest()->where('published', 1)->where('auction_product', 1);
if (get_setting('seller_auction_product') == 0) {
$products = $products->where('added_by', 'admin');
@@ -32,4 +34,32 @@ class AuctionProductController extends Controller
$detailedProduct = Product::where('id', $id)->get();
return new AuctionProductDetailCollection($detailedProduct);
}
public function bided_products_list()
{
$own_bids = AuctionProductBid::where('user_id', auth()->id())->orderBy('id', 'desc')->pluck('product_id');
$bided_products = Product::whereIn('id', $own_bids)->paginate(10);
return AuctionBidProducts::collection($bided_products);
}
public function user_purchase_history(Request $request)
{
$orders = DB::table('orders')
->orderBy('code', 'desc')
->join('order_details', 'orders.id', '=', 'order_details.order_id')
->join('products', 'order_details.product_id', '=', 'products.id')
->where('orders.user_id', auth()->user()->id)
->where('products.auction_product', '1');
if ($request->payment_status != "" || $request->payment_status != null) {
$orders = $orders->where('orders.payment_status', $request->payment_status);
}
if ($request->delivery_status != "" || $request->delivery_status != null) {
$orders = $orders->where('orders.delivery_status', $request->delivery_status);
}
$orders = $orders->select('order_details.order_id as id')->paginate(15);
return AuctionPurchaseHistory::collection($orders);
}
}

View File

@@ -52,17 +52,23 @@ class AuthController extends Controller
if ($validator->fails()) {
return response()->json([
'result' => false,
'message' => $validator->errors()
'message' => $validator->errors()->all()
]);
}
$user = new User([
'name' => $request->name,
'email' => $request->register_by == 'email' ? $request->email_or_phone : '',
'phone' => $request->register_by == 'phone' ? $request->email_or_phone : '',
'password' => bcrypt($request->password),
'verification_code' => rand(100000, 999999)
]);
$user = new User();
$user->name = $request->name;
if ($request->register_by == 'email') {
$user->email = $request->email_or_phone;
}
if ($request->register_by == 'phone') {
$user->phone = $request->email_or_phone;
}
$user->password = bcrypt($request->password);
$user->verification_code = rand(100000, 999999);
$user->save();
$user->email_verified_at = null;
if ($user->email != null) {
@@ -172,9 +178,9 @@ class AuthController extends Controller
if (!$user->banned) {
if (Hash::check($request->password, $user->password)) {
if ($user->email_verified_at == null) {
return response()->json(['result' => false, 'message' => translate('Please verify your account'), 'user' => null], 401);
}
// if ($user->email_verified_at == null) {
// return response()->json(['result' => false, 'message' => translate('Please verify your account'), 'user' => null], 401);
// }
return $this->loginSuccess($user);
} else {
return response()->json(['result' => false, 'message' => translate('Unauthorized'), 'user' => null], 401);

View File

@@ -6,6 +6,8 @@ use App\Models\Cart;
use App\Models\Product;
use App\Models\Shop;
use App\Models\User;
use App\Utility\CartUtility;
use App\Utility\NagadUtility;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
@@ -30,29 +32,29 @@ class CartController extends Controller
$sum = 0.00;
$subtotal = 0.00;
$tax = 0.00;
$tax = 0.00;
foreach ($items as $cartItem) {
$product = Product::find($cartItem['product_id']);
$subtotal += cart_product_price($cartItem, $product, false, false) * $cartItem['quantity'];
$tax += cart_product_tax($cartItem, $product, false) * $cartItem['quantity'];
}
$shipping_cost = $items->sum('shipping_cost');
$sum = $subtotal + $tax + $shipping_cost;
$discount = $items->sum('discount');
$sum = ($subtotal + $tax + $shipping_cost) - $discount;
return response()->json([
'sub_total' => format_price($subtotal),
'tax' => format_price($tax),
'shipping_cost' => format_price($shipping_cost ),
'discount' => format_price($items->sum('discount')),
'grand_total' => format_price($sum),
'sub_total' => single_price($subtotal),
'tax' => single_price($tax),
'shipping_cost' => single_price($shipping_cost),
'discount' => single_price($discount),
'grand_total' => single_price($sum),
'grand_total_value' => convert_price($sum),
'coupon_code' => $items[0]->coupon_code,
'coupon_applied' => $items[0]->coupon_applied == 1,
]);
}
public function count()
{
$items = auth()->user()->carts;
@@ -63,13 +65,13 @@ class CartController extends Controller
]);
}
public function getList()
{
$owner_ids = Cart::where('user_id', auth()->user()->id)->select('owner_id')->groupBy('owner_id')->pluck('owner_id')->toArray();
$currency_symbol = currency_symbol();
$shops = [];
$sub_total = 0.00;
$grand_total = 0.00;
if (!empty($owner_ids)) {
foreach ($owner_ids as $owner_id) {
$shop = array();
@@ -78,124 +80,135 @@ class CartController extends Controller
if (!empty($shop_items_raw_data)) {
foreach ($shop_items_raw_data as $shop_items_raw_data_item) {
$product = Product::where('id', $shop_items_raw_data_item["product_id"])->first();
$shop_items_data_item["id"] = intval($shop_items_raw_data_item["id"]) ;
$shop_items_data_item["owner_id"] =intval($shop_items_raw_data_item["owner_id"]) ;
$shop_items_data_item["user_id"] =intval($shop_items_raw_data_item["user_id"]) ;
$shop_items_data_item["product_id"] =intval($shop_items_raw_data_item["product_id"]) ;
$price = cart_product_price($shop_items_raw_data_item, $product, false, false) * intval($shop_items_raw_data_item["quantity"]);
$tax = cart_product_tax($shop_items_raw_data_item, $product, false);
$shop_items_data_item["id"] = intval($shop_items_raw_data_item["id"]);
$shop_items_data_item["owner_id"] = intval($shop_items_raw_data_item["owner_id"]);
$shop_items_data_item["user_id"] = intval($shop_items_raw_data_item["user_id"]);
$shop_items_data_item["product_id"] = intval($shop_items_raw_data_item["product_id"]);
$shop_items_data_item["product_name"] = $product->getTranslation('name');
$shop_items_data_item["auction_product"] = $product->auction_product;
$shop_items_data_item["product_thumbnail_image"] = uploaded_asset($product->thumbnail_img);
$shop_items_data_item["variation"] = $shop_items_raw_data_item["variation"];
$shop_items_data_item["price"] =(double) cart_product_price($shop_items_raw_data_item, $product, false, false);
$shop_items_data_item["price"] = (float) cart_product_price($shop_items_raw_data_item, $product, false, false);
$shop_items_data_item["currency_symbol"] = $currency_symbol;
$shop_items_data_item["tax"] =(double) cart_product_tax($shop_items_raw_data_item, $product,false);
$shop_items_data_item["shipping_cost"] =(double) $shop_items_raw_data_item["shipping_cost"];
$shop_items_data_item["quantity"] =intval($shop_items_raw_data_item["quantity"]) ;
$shop_items_data_item["lower_limit"] = intval($product->min_qty) ;
$shop_items_data_item["upper_limit"] = intval($product->stocks->where('variant', $shop_items_raw_data_item['variation'])->first()->qty) ;
$shop_items_data_item["tax"] = (float) cart_product_tax($shop_items_raw_data_item, $product, false);
$shop_items_data_item["price"] = single_price($price);
$shop_items_data_item["currency_symbol"] = $currency_symbol;
$shop_items_data_item["tax"] = single_price($tax);
// $shop_items_data_item["tax"] = (float) cart_product_tax($shop_items_raw_data_item, $product, false);
$shop_items_data_item["shipping_cost"] = (float) $shop_items_raw_data_item["shipping_cost"];
$shop_items_data_item["quantity"] = intval($shop_items_raw_data_item["quantity"]);
$shop_items_data_item["lower_limit"] = intval($product->min_qty);
$shop_items_data_item["upper_limit"] = intval($product->stocks->where('variant', $shop_items_raw_data_item['variation'])->first()->qty);
$sub_total += $price + $tax;
$shop_items_data[] = $shop_items_data_item;
}
}
$grand_total += $sub_total;
$shop_data = Shop::where('user_id', $owner_id)->first();
if ($shop_data) {
$shop['name'] = $shop_data->name;
$shop['owner_id'] =(int) $owner_id;
$shop['owner_id'] = (int) $owner_id;
$shop['sub_total'] = single_price($sub_total);
$shop['cart_items'] = $shop_items_data;
} else {
$shop['name'] = "Inhouse";
$shop['owner_id'] =(int) $owner_id;
$shop['owner_id'] = (int) $owner_id;
$shop['sub_total'] = single_price($sub_total);
$shop['cart_items'] = $shop_items_data;
}
$shops[] = $shop;
$sub_total = 0.00;
}
}
//dd($shops);
return response()->json($shops);
return response()->json([
"grand_total" => single_price($grand_total),
"data" =>
$shops
]);
}
public function add(Request $request)
{
$carts = Cart::where('user_id', auth()->user()->id)->get();
$check_auction_in_cart = CartUtility::check_auction_in_cart($carts);
$product = Product::findOrFail($request->id);
$variant = $request->variant;
$tax = 0;
if ($variant == '')
$price = $product->unit_price;
else {
$product_stock = $product->stocks->where('variant', $variant)->first();
$price = $product_stock->price;
if ($check_auction_in_cart && $product->auction_product == 0) {
return response()->json([
'result' => false,
'message' => translate('Remove auction product from cart to add this product.')
], 200);
}
//discount calculation based on flash deal and regular discount
//calculation of taxes
$discount_applicable = false;
if ($product->discount_start_date == null) {
$discount_applicable = true;
}
elseif (strtotime(date('d-m-Y H:i:s')) >= $product->discount_start_date &&
strtotime(date('d-m-Y H:i:s')) <= $product->discount_end_date) {
$discount_applicable = true;
}
if ($discount_applicable) {
if($product->discount_type == 'percent'){
$price -= ($price*$product->discount)/100;
}
elseif($product->discount_type == 'amount'){
$price -= $product->discount;
}
}
foreach ($product->taxes as $product_tax) {
if ($product_tax->tax_type == 'percent') {
$tax += ($price * $product_tax->tax) / 100;
} elseif ($product_tax->tax_type == 'amount') {
$tax += $product_tax->tax;
}
if ($check_auction_in_cart == false && count($carts) > 0 && $product->auction_product == 1) {
return response()->json([
'result' => false,
'message' => translate('Remove other products from cart to add this auction product.')
], 200);
}
if ($product->min_qty > $request->quantity) {
return response()->json(['result' => false, 'message' => translate("Minimum")." {$product->min_qty} ".translate("item(s) should be ordered")], 200);
return response()->json([
'result' => false,
'message' => translate("Minimum") . " {$product->min_qty} " . translate("item(s) should be ordered")
], 200);
}
$stock = $product->stocks->where('variant', $variant)->first()->qty;
$variant = $request->variant;
$tax = 0;
$quantity = $request->quantity;
$variant_string = $variant != null && $variant != "" ? translate("for")." ($variant)" : "";
if ($stock < $request->quantity && $product->digital == 0) {
if ($stock == 0) {
return response()->json(['result' => false, 'message' => "Stock out"], 200);
} else {
return response()->json(['result' => false, 'message' => translate("Only") ." {$stock} ".translate("item(s) are available")." {$variant_string}"], 200);
}
}
$product_stock = $product->stocks->where('variant', $variant)->first();
$cart_item = Cart::where('product_id', $request->id)->where("user_id",auth()->id())->first();
if($cart_item && $cart_item->product->digital == 1) {
return response()->json(['result' => false, 'message' => 'Already added this product' ]);
}
Cart::updateOrCreate([
$cart = Cart::firstOrNew([
'variation' => $variant,
'user_id' => auth()->user()->id,
'owner_id' => $product->user_id,
'product_id' => $request->id,
'variation' => $variant
], [
'price' => $price,
'tax' => $tax,
'shipping_cost' => 0,
'quantity' => DB::raw("quantity + $request->quantity")
'product_id' => $request['id']
]);
if(\App\Utility\NagadUtility::create_balance_reference($request->cost_matrix) == false){
return response()->json(['result' => false, 'message' => 'Cost matrix error' ]);
$variant_string = $variant != null && $variant != "" ? translate("for") . " ($variant)" : "";
if ($cart->exists && $product->digital == 0) {
if ($product->auction_product == 1 && ($cart->product_id == $product->id)) {
return response()->json([
'result' => false,
'message' => translate('This auction product is already added to your cart.')
], 200);
}
if ($product_stock->qty < $cart->quantity + $request['quantity']) {
if ($product_stock->qty == 0) {
return response()->json([
'result' => false,
'message' => translate("Stock out")
], 200);
} else {
return response()->json([
'result' => false,
'message' => translate("Only") . " {$product_stock->qty} " . translate("item(s) are available") . " {$variant_string}"
], 200);
}
}
if ($product->digital == 1 && ($cart->product_id == $product->id)) {
return response()->json([
'result' => false,
'message' => translate('Already added this product')
]);
}
$quantity = $cart->quantity + $request['quantity'];
}
$price = CartUtility::get_price($product, $product_stock, $request->quantity);
$tax = CartUtility::tax_calculation($product, $price);
CartUtility::save_cart_data($cart, $product, $price, $tax, $quantity);
if (NagadUtility::create_balance_reference($request->cost_matrix) == false) {
return response()->json(['result' => false, 'message' => 'Cost matrix error']);
}
return response()->json([
@@ -208,7 +221,10 @@ class CartController extends Controller
{
$cart = Cart::find($request->id);
if ($cart != null) {
$product = Product::find($cart->product_id);
if ($product->auction_product == 1) {
return response()->json(['result' => false, 'message' => translate('Maximum available quantity reached')], 200);
}
if ($cart->product->stocks->where('variant', $cart->variation)->first()->qty >= $request->quantity) {
$cart->update([
'quantity' => $request->quantity
@@ -235,7 +251,7 @@ class CartController extends Controller
$product = Product::where('id', $cart_item->product_id)->first();
if ($product->min_qty > $cart_quantities[$i]) {
return response()->json(['result' => false, 'message' => translate("Minimum")." {$product->min_qty} ".translate("item(s) should be ordered for")." {$product->name}"], 200);
return response()->json(['result' => false, 'message' => translate("Minimum") . " {$product->min_qty} " . translate("item(s) should be ordered for") . " {$product->name}"], 200);
}
$stock = $cart_item->product->stocks->where('variant', $cart_item->variation)->first()->qty;
@@ -244,26 +260,21 @@ class CartController extends Controller
$cart_item->update([
'quantity' => $cart_quantities[$i]
]);
} else {
if ($stock == 0 ) {
return response()->json(['result' => false, 'message' => translate("No item is available for")." {$product->name}{$variant_string},".translate("remove this from cart")], 200);
if ($stock == 0) {
return response()->json(['result' => false, 'message' => translate("No item is available for") . " {$product->name}{$variant_string}," . translate("remove this from cart")], 200);
} else {
return response()->json(['result' => false, 'message' => translate("Only")." {$stock} ".translate("item(s) are available for")." {$product->name}{$variant_string}"], 200);
return response()->json(['result' => false, 'message' => translate("Only") . " {$stock} " . translate("item(s) are available for") . " {$product->name}{$variant_string}"], 200);
}
}
$i++;
}
return response()->json(['result' => true, 'message' => translate('Cart updated')], 200);
} else {
return response()->json(['result' => false, 'message' => translate('Cart is empty')], 200);
}
}
public function destroy($id)

View File

@@ -94,7 +94,7 @@ class CheckoutController
}
if($coupon_discount>0){
Cart::where('user_id', auth()->user()->id)->update([
Cart::where('user_id', auth()->user()->id)->where('owner_id', $coupon->user_id)->update([
'discount' => $coupon_discount / count($cart_items),
'coupon_code' => $request->coupon_code,
'coupon_applied' => 1

View File

@@ -32,7 +32,7 @@ public function purchase_package_free(Request $request)
$user->save();
return $this->success(translate('Package purchasing successful'));
} else {
return $this->failed(translate('You can not purchase this package anymore.'));
return $this->failed(translate('You cannot purchase this package anymore.'));
}
}

View File

@@ -16,20 +16,19 @@ class DigitalProductController extends Controller
{
$product = Product::findOrFail($request->id);
$orders = Order::select("id")->where('user_id', auth()->user()->id)->pluck('id');
$orderDetails = OrderDetail::where("product_id",$request->id)->whereIn("order_id",$orders)->get();
$orderDetails = OrderDetail::where("product_id", $request->id)->whereIn("order_id", $orders)->get();
if (auth()->user()->user_type == 'admin' || auth()->user()->id == $product->user_id || $orderDetails) {
$upload = Upload::findOrFail($product->file_name);
if (env('FILESYSTEM_DRIVER') == "s3") {
return \Storage::disk('s3')->download($upload->file_name, $upload->file_original_name . "." . $upload->extension);
} else {
if (file_exists(base_path('public/' . $upload->file_name))) {
$file = public_path()."/$upload->file_name";
return response()->download($file,config('app.name')."_".$upload->file_original_name);
$file = public_path() . "/$upload->file_name";
return response()->download($file, config('app.name') . "_" . $upload->file_original_name . "." . $upload->extension);
}
}
} else {
return response()->download(File("dd.pdf"),"failed.jpg");
return response()->download(File("dd.pdf"), "failed.jpg");
}
}
}

View File

@@ -31,11 +31,11 @@ class PaymentTypesController
$payment_type['payment_type_key'] = 'paypal';
$payment_type['image'] = static_asset('assets/img/cards/paypal.png');
$payment_type['name'] = "Paypal";
$payment_type['title'] = "Checkout with Paypal";
$payment_type['title'] = translate("Checkout with Paypal");
$payment_type['offline_payment_id'] = 0;
$payment_type['details'] = "";
if ($mode == 'wallet') {
$payment_type['title'] = "Recharge with Paypal";
$payment_type['title'] = translate("Recharge with Paypal");
}
$payment_types[] = $payment_type;
@@ -47,11 +47,11 @@ class PaymentTypesController
$payment_type['payment_type_key'] = 'stripe';
$payment_type['image'] = static_asset('assets/img/cards/stripe.png');
$payment_type['name'] = "Stripe";
$payment_type['title'] = "Checkout with Stripe";
$payment_type['title'] = translate("Checkout with Stripe");
$payment_type['offline_payment_id'] = 0;
$payment_type['details'] = "";
if ($mode == 'wallet') {
$payment_type['title'] = "Recharge with Stripe";
$payment_type['title'] = translate("Recharge with Stripe");
}
$payment_types[] = $payment_type;
@@ -62,11 +62,11 @@ class PaymentTypesController
$payment_type['payment_type_key'] = 'instamojo_payment';
$payment_type['image'] = static_asset('assets/img/cards/instamojo.png');
$payment_type['name'] = "Instamojo";
$payment_type['title'] = "Checkout with Instamojo";
$payment_type['title'] = translate("Checkout with Instamojo");
$payment_type['offline_payment_id'] = 0;
$payment_type['details'] = "";
if ($mode == 'wallet') {
$payment_type['title'] = "Recharge with Stripe";
$payment_type['title'] = translate("Recharge with Instamojo");
}
$payment_types[] = $payment_type;
@@ -78,11 +78,11 @@ class PaymentTypesController
$payment_type['payment_type_key'] = 'razorpay';
$payment_type['image'] = static_asset('assets/img/cards/rozarpay.png');
$payment_type['name'] = "Razorpay";
$payment_type['title'] = "Checkout with Razorpay";
$payment_type['title'] = translate("Checkout with Razorpay");
$payment_type['offline_payment_id'] = 0;
$payment_type['details'] = "";
if ($mode == 'wallet') {
$payment_type['title'] = "Recharge with Razorpay";
$payment_type['title'] = translate("Recharge with Razorpay");
}
$payment_types[] = $payment_type;
@@ -94,11 +94,11 @@ class PaymentTypesController
$payment_type['payment_type_key'] = 'paystack';
$payment_type['image'] = static_asset('assets/img/cards/paystack.png');
$payment_type['name'] = "Paystack";
$payment_type['title'] = "Checkout with Paystack";
$payment_type['title'] = translate("Checkout with Paystack");
$payment_type['offline_payment_id'] = 0;
$payment_type['details'] = "";
if ($mode == 'wallet') {
$payment_type['title'] = "Recharge with Paystack";
$payment_type['title'] = translate("Recharge with Paystack");
}
$payment_types[] = $payment_type;
@@ -110,11 +110,11 @@ class PaymentTypesController
$payment_type['payment_type_key'] = 'iyzico';
$payment_type['image'] = static_asset('assets/img/cards/iyzico.png');
$payment_type['name'] = "Iyzico";
$payment_type['title'] = "Checkout with Iyzico";
$payment_type['title'] = translate("Checkout with Iyzico");
$payment_type['offline_payment_id'] = 0;
$payment_type['details'] = "";
if ($mode == 'wallet') {
$payment_type['title'] = "Recharge with Iyzico";
$payment_type['title'] = translate("Recharge with Iyzico");
}
$payment_types[] = $payment_type;
@@ -126,11 +126,11 @@ class PaymentTypesController
$payment_type['payment_type_key'] = 'bkash';
$payment_type['image'] = static_asset('assets/img/cards/bkash.png');
$payment_type['name'] = "Bkash";
$payment_type['title'] = "Checkout with Bkash";
$payment_type['title'] = translate("Checkout with Bkash");
$payment_type['offline_payment_id'] = 0;
$payment_type['details'] = "";
if ($mode == 'wallet') {
$payment_type['title'] = "Recharge with Bkash";
$payment_type['title'] = translate("Recharge with Bkash");
}
$payment_types[] = $payment_type;
@@ -142,11 +142,11 @@ class PaymentTypesController
$payment_type['payment_type_key'] = 'nagad';
$payment_type['image'] = static_asset('assets/img/cards/nagad.png');
$payment_type['name'] = "Nagad";
$payment_type['title'] = "Checkout with Nagad";
$payment_type['title'] = translate("Checkout with Nagad");
$payment_type['offline_payment_id'] = 0;
$payment_type['details'] = "";
if ($mode == 'wallet') {
$payment_type['title'] = "Recharge with Nagad";
$payment_type['title'] = translate("Recharge with Nagad");
}
$payment_types[] = $payment_type;
@@ -158,11 +158,11 @@ class PaymentTypesController
$payment_type['payment_type_key'] = 'sslcommerz';
$payment_type['image'] = static_asset('assets/img/cards/sslcommerz.png');
$payment_type['name'] = "Sslcommerz";
$payment_type['title'] = "Checkout with Sslcommerz";
$payment_type['title'] = translate("Checkout with Sslcommerz");
$payment_type['offline_payment_id'] = 0;
$payment_type['details'] = "";
if ($mode == 'wallet') {
$payment_type['title'] = "Recharge with Sslcommerz";
$payment_type['title'] = translate("Recharge with Sslcommerz");
}
$payment_types[] = $payment_type;
@@ -176,11 +176,11 @@ class PaymentTypesController
$payment_type['payment_type_key'] = 'flutterwave';
$payment_type['image'] = static_asset('assets/img/cards/flutterwave.png');
$payment_type['name'] = "Flutterwave";
$payment_type['title'] = "Checkout with Flutterwave";
$payment_type['title'] = translate("Checkout with Flutterwave");
$payment_type['offline_payment_id'] = 0;
$payment_type['details'] = "";
if ($mode == 'wallet') {
$payment_type['title'] = "Recharge with Flutterwave";
$payment_type['title'] = translate("Recharge with Flutterwave");
}
$payment_types[] = $payment_type;
@@ -194,11 +194,11 @@ class PaymentTypesController
$payment_type['payment_type_key'] = 'paytm';
$payment_type['image'] = static_asset('assets/img/cards/paytm.jpg');
$payment_type['name'] = "Paytm";
$payment_type['title'] = "Checkout with Paytm";
$payment_type['title'] = translate("Checkout with Paytm");
$payment_type['offline_payment_id'] = 0;
$payment_type['details'] = "";
if ($mode == 'wallet') {
$payment_type['title'] = "Recharge with Paytm";
$payment_type['title'] = translate("Recharge with Paytm");
}
$payment_types[] = $payment_type;
@@ -209,11 +209,11 @@ class PaymentTypesController
$payment_type['payment_type_key'] = 'khalti';
$payment_type['image'] = static_asset('assets/img/cards/khalti.png');
$payment_type['name'] = "Khalti";
$payment_type['title'] = "Checkout with Khalti";
$payment_type['title'] = translate("Checkout with Khalti");
$payment_type['offline_payment_id'] = 0;
$payment_type['details'] = "";
if ($mode == 'wallet') {
$payment_type['title'] = "Recharge with Khalti";
$payment_type['title'] = translate("Recharge with Khalti");
}
$payment_types[] = $payment_type;
@@ -229,7 +229,7 @@ class PaymentTypesController
$payment_type['payment_type_key'] = 'wallet';
$payment_type['image'] = static_asset('assets/img/cards/wallet.png');
$payment_type['name'] = "Wallet";
$payment_type['title'] = "Wallet Payment";
$payment_type['title'] = translate("Wallet Payment");
$payment_type['offline_payment_id'] = 0;
$payment_type['details'] = "";
@@ -257,7 +257,7 @@ class PaymentTypesController
$payment_type['payment_type_key'] = 'cash_on_delivery';
$payment_type['image'] = static_asset('assets/img/cards/cod.png');
$payment_type['name'] = "Cash Payment";
$payment_type['title'] = "Cash on delivery";
$payment_type['title'] = translate("Cash on delivery");
$payment_type['offline_payment_id'] = 0;
$payment_type['details'] = "";

View File

@@ -6,11 +6,13 @@ use App\Http\Resources\V2\PurchasedResource;
use App\Http\Resources\V2\PurchaseHistoryMiniCollection;
use App\Http\Resources\V2\PurchaseHistoryCollection;
use App\Http\Resources\V2\PurchaseHistoryItemsCollection;
use App\Models\Cart;
use App\Models\Order;
use App\Models\OrderDetail;
use App\Models\Product;
use Illuminate\Http\Request;
use App\Models\User;
use App\Utility\CartUtility;
use Illuminate\Support\Facades\DB;
class PurchaseHistoryController extends Controller
@@ -77,4 +79,87 @@ class PurchaseHistoryController extends Controller
return PurchasedResource::collection($order_detail_products);
}
public function re_order($id)
{
$user_id = auth()->user()->id;
$success_msgs = [];
$failed_msgs = [];
$carts = Cart::where('user_id', auth()->user()->id)->get();
$check_auction_in_cart = CartUtility::check_auction_in_cart($carts);
if ($check_auction_in_cart) {
array_push($failed_msgs, translate('Remove auction product from cart to add products.'));
return response()->json([
'success_msgs' => $success_msgs,
'failed_msgs' => $failed_msgs
]);
}
$order = Order::findOrFail($id);
$data['user_id'] = $user_id;
foreach ($order->orderDetails as $key => $orderDetail) {
$product = $orderDetail->product;
if (
!$product || $product->published == 0 ||
$product->approved == 0 || ($product->wholesale_product && !addon_is_activated("wholesale"))
) {
array_push($failed_msgs, translate('An item from this order is not available now.'));
continue;
}
if ($product->auction_product == 1) {
array_push($failed_msgs, translate('You can not re order an auction product.'));
break;
}
// If product min qty is greater then the ordered qty, then update the order qty
$order_qty = $orderDetail->quantity;
if ($product->digital == 0 && $order_qty < $product->min_qty) {
$order_qty = $product->min_qty;
}
$cart = Cart::firstOrNew([
'variation' => $orderDetail->variation,
'user_id' => $user_id,
'product_id' => $product->id
]);
$product_stock = $product->stocks->where('variant', $orderDetail->variation)->first();
if ($product_stock) {
$quantity = 1;
if ($product->digital != 1) {
$quantity = $product_stock->qty;
if ($quantity > 0) {
if ($cart->exists) {
$order_qty = $cart->quantity + $order_qty;
}
//If order qty is greater then the product stock, set order qty = current product stock qty
$quantity = ($quantity >= $order_qty) ? $order_qty : $quantity;
} else {
array_push($failed_msgs, $product->getTranslation('name') . ' ' . translate('is stock out.'));
continue;
}
}
$price = CartUtility::get_price($product, $product_stock, $quantity);
$tax = CartUtility::tax_calculation($product, $price);
CartUtility::save_cart_data($cart, $product, $price, $tax, $quantity);
array_push($success_msgs, $product->getTranslation('name') . ' ' . translate('added to cart.'));
} else {
array_push($failed_msgs, $product->getTranslation('name') . ' ' . translate(' is stock out.'));
}
}
return response()->json([
'success_msgs' => $success_msgs,
'failed_msgs' => $failed_msgs
]);
}
}

View File

@@ -55,7 +55,7 @@ class ConversationController extends Controller
return $this->success(translate('Message send successfully'));
}else{
return $this->failed(translate('You can not send this message.'));
return $this->failed(translate('You cannot send this message.'));
}
}
@@ -87,7 +87,7 @@ class ConversationController extends Controller
return new MessageCollection($messages);
} else {
return $this->failed(translate('You can not see this message.'));
return $this->failed(translate('You cannot see this message.'));
}

View File

@@ -0,0 +1,157 @@
<?php
namespace App\Http\Controllers\Api\V2\Seller;
use App\Http\Controllers\Api\V2\Controller;
use App\Http\Resources\V2\Seller\DigitalProductCollection;
use App\Http\Resources\V2\Seller\CategoriesCollection;
use App\Http\Resources\V2\Seller\DigitalProductDetailsResource;
use App\Models\Category;
use Illuminate\Http\Request;
use App\Models\Product;
use App\Models\ProductTax;
use App\Models\ProductTranslation;
use App\Models\Upload;
use Auth;
use App\Services\ProductService;
use App\Services\ProductStockService;
use App\Services\ProductTaxService;
use Artisan;
class DigitalProductController extends Controller
{
public function index()
{
$products = Product::where('digital', 1)->where('user_id', Auth::user()->id)->orderBy('created_at', 'desc');
return new DigitalProductCollection($products->paginate(10));
}
public function getCategory()
{
$categories = Category::where('parent_id', 0)
->where('digital', 1)
->with('childrenCategories')
->get();
return CategoriesCollection::collection($categories);
}
public function store(Request $request)
{
if (addon_is_activated('seller_subscription')) {
if (!seller_package_validity_check(auth()->user()->id)) {
return $this->failed(translate('Please upgrade your package.'));
}
}
if (auth()->user()->user_type != 'seller') {
return $this->failed(translate('Unauthenticated User.'));
}
// Product Store
$product = (new ProductService)->store($request->except([
'_token', 'tax_id', 'tax', 'tax_type'
]));
$request->merge(['product_id' => $product->id, 'current_stock' => 0]);
//Product Stock
(new ProductStockService)->store($request->only([
'unit_price', 'current_stock', 'product_id'
]), $product);
//VAT & Tax
if ($request->tax_id) {
(new ProductTaxService)->store($request->only([
'tax_id', 'tax', 'tax_type', 'product_id'
]));
}
// Product Translations
$request->merge(['lang' => env('DEFAULT_LANGUAGE')]);
ProductTranslation::create($request->only([
'lang', 'name', 'unit', 'description', 'product_id'
]));
return $this->success(translate('Digital Product has been inserted successfully'));
}
public function edit(Request $request, $id)
{
$product = Product::findOrFail($id);
$product->lang = $request->lang == null ? env("DEFAULT_LANGUAGE") : $request->lang;
return new DigitalProductDetailsResource($product);
}
public function update(Request $request, Product $product)
{
//Product Update
$product = (new ProductService)->update($request->except([
'_token', 'tax_id', 'tax', 'tax_type'
]), $product);
//Product Stock
foreach ($product->stocks as $key => $stock) {
$stock->delete();
}
$request->merge(['product_id' => $product->id, 'current_stock' => 0]);
(new ProductStockService)->store($request->only([
'unit_price', 'current_stock', 'product_id'
]), $product);
//VAT & Tax
if ($request->tax_id) {
ProductTax::where('product_id', $product->id)->delete();
(new ProductTaxService)->store($request->only([
'tax_id', 'tax', 'tax_type', 'product_id'
]));
}
// Product Translations
ProductTranslation::updateOrCreate(
$request->only(['lang', 'product_id']),
$request->only(['name', 'description'])
);
return $this->success(translate('Digital Product has been Updated successfully'));
}
public function destroy($id)
{
$product_destroy = (new ProductService)->destroy($id);
if ($product_destroy) {
Artisan::call('view:clear');
Artisan::call('cache:clear');
return $this->success(translate('Digital Product deleted successfully'));
}
return $this->failed(translate('Something Went Wrong.'));
}
// Digital Product File Download
public function download($id)
{
if (auth()->user()->user_type != 'seller') {
return $this->failed(translate('Unauthenticated User.'));
}
$product = Product::where('id', $id)->where('user_id', auth()->user()->id)->first();
if (!$product) {
return $this->failed(translate('This product is not yours'));
}
$upload = Upload::findOrFail($product->file_name);
if (env('FILESYSTEM_DRIVER') == "s3") {
return \Storage::disk('s3')->download($upload->file_name, $upload->file_original_name . "." . $upload->extension);
} else {
if (file_exists(base_path('public/' . $upload->file_name))) {
$file = public_path() . "/$upload->file_name";
return response()->download($file, config('app.name') . "_" . $upload->file_original_name . "." . $upload->extension);
}
}
}
}

View File

@@ -196,6 +196,12 @@ class ProductController extends Controller
public function change_status(Request $request)
{
if (addon_is_activated('seller_subscription')) {
if (!seller_package_validity_check()) {
return $this->failed(translate('Please upgrade your package'));
}
}
$product = Product::where('user_id', auth()->user()->id)
->where('id', $request->id)
->update([

View File

@@ -122,12 +122,11 @@ class ShopController extends Controller
->select(DB::raw("sum(grand_total) as total, DATE_FORMAT(created_at, '%b-%d') as date"))
->groupBy(DB::raw("DATE_FORMAT(created_at, '%Y-%m-%d')"))
->get()->toArray();
//dd($data->toArray());
//$array_date = [];
$sales_array = [];
for ($i = 0; $i < 7; $i++) {
$new_date = date("M-d", strtotime(($i + 1) . " days ago"));
for ($i = 1; $i < 8; $i++) {
$new_date = date("M-d", strtotime(($i - 1) . " days ago"));
//$array_date[] = date("M-d", strtotime($i." days ago"));
$sales_array[$i]['date'] = $new_date;

View File

@@ -1,4 +1,5 @@
<?php
namespace App\Http\Controllers\Api\V2;
use App\Models\Order;
@@ -6,12 +7,15 @@ use Illuminate\Http\Request;
use App\Http\Resources\V2\PurchaseHistoryMiniCollection;
use App\Http\Resources\V2\PurchaseHistoryCollection;
use App\Http\Resources\V2\PurchaseHistoryItemsCollection;
use App\Http\Resources\V2\ShopCollection;
use App\Models\OrderDetail;
class SellerController extends Controller {
class SellerController extends Controller
{
public function topSellers()
{
$best_selers = get_best_sellers(5);
return new ShopCollection($best_selers);
}
}
?>

View File

@@ -27,39 +27,39 @@ class ShippingController extends Controller
foreach ($request->seller_list as $key => $seller) {
$seller['shipping_cost'] = 0;
$carts = Cart::where('user_id', auth()->user()->id)->where("owner_id", $seller['seller_id'])->get();
foreach ($carts as $key => $cartItem) {
$cartItem['shipping_cost'] = 0;
if($seller['shipping_type'] == 'pickup_point') {
if ($seller['shipping_type'] == 'pickup_point') {
$cartItem['shipping_type'] = 'pickup_point';
$cartItem['pickup_point'] = $seller['shipping_id'];
}else
} else
if ($seller['shipping_type'] == 'home_delivery') {
$cartItem['shipping_type'] = 'home_delivery';
$cartItem['pickup_point'] = 0;
$cartItem['shipping_cost'] = getShippingCost($main_carts, $key);
}else
} else
if ($seller['shipping_type'] == 'carrier') {
$cartItem['shipping_type'] = 'carrier';
$cartItem['pickup_point'] = 0;
$cartItem['carrier_id'] = $seller['shipping_id'];
$cartItem['shipping_cost'] = getShippingCost($carts, $key,$seller['shipping_id']);
$cartItem['shipping_cost'] = getShippingCost($carts, $key, $seller['shipping_id']);
}
$cartItem->save();
}
}
//Total shipping cost $calculate_shipping
$total_shipping_cost = Cart::where('user_id', auth()->user()->id)->sum('shipping_cost');
return response()->json(['result' => true, 'shipping_type' => get_setting('shipping_type'), 'value' => convert_price($total_shipping_cost), 'value_string' => format_price($total_shipping_cost)], 200);
return response()->json(['result' => true, 'shipping_type' => get_setting('shipping_type'), 'value' => convert_price($total_shipping_cost), 'value_string' => format_price(convert_price($total_shipping_cost))], 200);
}
public function getDeliveryInfo()
{
$owner_ids = Cart::where('user_id', auth()->user()->id)->select('owner_id')->groupBy('owner_id')->pluck('owner_id')->toArray();
@@ -73,13 +73,14 @@ class ShippingController extends Controller
if (!empty($shop_items_raw_data)) {
foreach ($shop_items_raw_data as $shop_items_raw_data_item) {
$product = Product::where('id', $shop_items_raw_data_item["product_id"])->first();
$shop_items_data_item["id"] = intval($shop_items_raw_data_item["id"]) ;
$shop_items_data_item["owner_id"] =intval($shop_items_raw_data_item["owner_id"]) ;
$shop_items_data_item["user_id"] =intval($shop_items_raw_data_item["user_id"]) ;
$shop_items_data_item["product_id"] =intval($shop_items_raw_data_item["product_id"]) ;
$shop_items_data_item["id"] = intval($shop_items_raw_data_item["id"]);
$shop_items_data_item["owner_id"] = intval($shop_items_raw_data_item["owner_id"]);
$shop_items_data_item["user_id"] = intval($shop_items_raw_data_item["user_id"]);
$shop_items_data_item["product_id"] = intval($shop_items_raw_data_item["product_id"]);
$shop_items_data_item["product_name"] = $product->getTranslation('name');
$shop_items_data_item["product_thumbnail_image"] = uploaded_asset($product->thumbnail_img);
/*
$shop_items_data_item["product_is_digital"] = $product->digital == 1;
/*
$shop_items_data_item["variation"] = $shop_items_raw_data_item["variation"];
$shop_items_data_item["price"] =(double) cart_product_price($shop_items_raw_data_item, $product, false, false);
$shop_items_data_item["currency_symbol"] = $currency_symbol;
@@ -90,7 +91,6 @@ class ShippingController extends Controller
$shop_items_data_item["upper_limit"] = intval($product->stocks->where('variant', $shop_items_raw_data_item['variation'])->first()->qty) ;
*/
$shop_items_data[] = $shop_items_data_item;
}
}
@@ -100,18 +100,16 @@ class ShippingController extends Controller
if ($shop_data) {
$shop['name'] = $shop_data->name;
$shop['owner_id'] =(int) $owner_id;
$shop['owner_id'] = (int) $owner_id;
$shop['cart_items'] = $shop_items_data;
} else {
$shop['name'] = "Inhouse";
$shop['owner_id'] =(int) $owner_id;
$shop['owner_id'] = (int) $owner_id;
$shop['cart_items'] = $shop_items_data;
}
$shop['carriers'] = seller_base_carrier_list($owner_id);
$shop['pickup_points']=[];
if(get_setting('pickup_point') == 1){
$shop['pickup_points'] = [];
if (get_setting('pickup_point') == 1) {
$pickup_point_list = PickupPoint::where('pick_up_status', '=', 1)->get();
$shop['pickup_points'] = PickupPointResource::collection($pickup_point_list);
}

View File

@@ -14,7 +14,7 @@ class WalletController extends Controller
$user = User::find(auth()->user()->id);
$latest = Wallet::where('user_id', auth()->user()->id)->latest()->first();
return response()->json([
'balance' => format_price($user->balance),
'balance' => single_price($user->balance),
'last_recharged' => $latest == null ? "Not Available" : $latest->created_at->diffForHumans(),
]);
}

View File

@@ -44,134 +44,134 @@ class RegisterController extends Controller
*
* @var string
*/
// protected $redirectTo = '/';
protected $redirectTo = '/';
// /**
// * Create a new controller instance.
// *
// * @return void
// */
// public function __construct()
// {
// $this->middleware('guest');
// }
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
// /**
// * Get a validator for an incoming registration request.
// *
// * @param array $data
// * @return \Illuminate\Contracts\Validation\Validator
// */
// protected function validator(array $data)
// {
// return Validator::make($data, [
// 'name' => 'required|string|max:255',
// 'password' => 'required|string|min:6|confirmed',
// 'g-recaptcha-response' => [
// Rule::when(get_setting('google_recaptcha') == 1, ['required', new Recaptcha()], ['sometimes'])
// ]
// ]);
// }
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|string|max:255',
'password' => 'required|string|min:6|confirmed',
'g-recaptcha-response' => [
Rule::when(get_setting('google_recaptcha') == 1, ['required', new Recaptcha()], ['sometimes'])
]
]);
}
// /**
// * Create a new user instance after a valid registration.
// *
// * @param array $data
// * @return \App\Models\User
// */
// protected function create(array $data)
// {
// if (filter_var($data['email'], FILTER_VALIDATE_EMAIL)) {
// $user = User::create([
// 'name' => $data['name'],
// 'email' => $data['email'],
// 'password' => Hash::make($data['password']),
// ]);
// }
// else {
// if (addon_is_activated('otp_system')){
// $user = User::create([
// 'name' => $data['name'],
// 'phone' => '+'.$data['country_code'].$data['phone'],
// 'password' => Hash::make($data['password']),
// 'verification_code' => rand(100000, 999999)
// ]);
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\Models\User
*/
protected function create(array $data)
{
if (filter_var($data['email'], FILTER_VALIDATE_EMAIL)) {
$user = User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
}
else {
if (addon_is_activated('otp_system')){
$user = User::create([
'name' => $data['name'],
'phone' => '+'.$data['country_code'].$data['phone'],
'password' => Hash::make($data['password']),
'verification_code' => rand(100000, 999999)
]);
// $otpController = new OTPVerificationController;
// $otpController->send_code($user);
// }
// }
$otpController = new OTPVerificationController;
$otpController->send_code($user);
}
}
// if(session('temp_user_id') != null){
// Cart::where('temp_user_id', session('temp_user_id'))
// ->update([
// 'user_id' => $user->id,
// 'temp_user_id' => null
// ]);
if(session('temp_user_id') != null){
Cart::where('temp_user_id', session('temp_user_id'))
->update([
'user_id' => $user->id,
'temp_user_id' => null
]);
// Session::forget('temp_user_id');
// }
Session::forget('temp_user_id');
}
// if(Cookie::has('referral_code')){
// $referral_code = Cookie::get('referral_code');
// $referred_by_user = User::where('referral_code', $referral_code)->first();
// if($referred_by_user != null){
// $user->referred_by = $referred_by_user->id;
// $user->save();
// }
// }
if(Cookie::has('referral_code')){
$referral_code = Cookie::get('referral_code');
$referred_by_user = User::where('referral_code', $referral_code)->first();
if($referred_by_user != null){
$user->referred_by = $referred_by_user->id;
$user->save();
}
}
// return $user;
// }
return $user;
}
// public function register(Request $request)
// {
// if (filter_var($request->email, FILTER_VALIDATE_EMAIL)) {
// if(User::where('email', $request->email)->first() != null){
// flash(translate('Email or Phone already exists.'));
// return back();
// }
// }
// elseif (User::where('phone', '+'.$request->country_code.$request->phone)->first() != null) {
// flash(translate('Phone already exists.'));
// return back();
// }
public function register(Request $request)
{
if (filter_var($request->email, FILTER_VALIDATE_EMAIL)) {
if(User::where('email', $request->email)->first() != null){
flash(translate('Email or Phone already exists.'));
return back();
}
}
elseif (User::where('phone', '+'.$request->country_code.$request->phone)->first() != null) {
flash(translate('Phone already exists.'));
return back();
}
// $this->validator($request->all())->validate();
$this->validator($request->all())->validate();
// $user = $this->create($request->all());
$user = $this->create($request->all());
// $this->guard()->login($user);
$this->guard()->login($user);
// if($user->email != null){
// if(BusinessSetting::where('type', 'email_verification')->first()->value != 1){
// $user->email_verified_at = date('Y-m-d H:m:s');
// $user->save();
// flash(translate('Registration successful.'))->success();
// }
// else {
// try {
// $user->sendEmailVerificationNotification();
// flash(translate('Registration successful. Please verify your email.'))->success();
// } catch (\Throwable $th) {
// $user->delete();
// flash(translate('Registration failed. Please try again later.'))->error();
// }
// }
// }
if($user->email != null){
if(BusinessSetting::where('type', 'email_verification')->first()->value != 1){
$user->email_verified_at = date('Y-m-d H:m:s');
$user->save();
flash(translate('Registration successful.'))->success();
}
else {
try {
$user->sendEmailVerificationNotification();
flash(translate('Registration successful. Please verify your email.'))->success();
} catch (\Throwable $th) {
$user->delete();
flash(translate('Registration failed. Please try again later.'))->error();
}
}
}
// return $this->registered($request, $user)
// ?: redirect($this->redirectPath());
// }
return $this->registered($request, $user)
?: redirect($this->redirectPath());
}
// protected function registered(Request $request, $user)
// {
// if ($user->email == null) {
// return redirect()->route('verification');
// }elseif(session('link') != null){
// return redirect(session('link'));
// }else {
// return redirect()->route('home');
// }
// }
protected function registered(Request $request, $user)
{
if ($user->email == null) {
return redirect()->route('verification');
}elseif(session('link') != null){
return redirect(session('link'));
}else {
return redirect()->route('home');
}
}
}

View File

@@ -8,31 +8,95 @@ use App\Models\User;
use Carbon\Carbon;
use Illuminate\Http\Request;
use App\Http\Controllers\OTPVerificationController;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
public function verify(Request $request, $id, $hash)
{
// Aquí debes implementar la lógica para verificar el token y marcar el correo electrónico como verificado
// Puedes usar el $id y $hash para buscar el usuario en la base de datos y realizar la verificación
use VerifiesEmails;
// Ejemplo de implementación:
$user = User::find($id);
/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = '/';
if ($user && hash_equals($hash, $user->confirmation_code)) {
$user->email_verified_at = now();
$user->save();
// Inicia sesión al usuario si lo deseas
auth()->login($user);
// Redirige al usuario a la página de éxito o a donde desees
return redirect()->route('shop.view.signup.complete');
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
//$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
// Si la verificación falla, puedes redirigir al usuario a una página de error o mostrar un mensaje de error
return redirect()->route('shop.view.email.verification');
}
/**
* Show the email verification notice.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function show(Request $request)
{
if ($request->user()->email != null) {
return $request->user()->hasVerifiedEmail()
? redirect($this->redirectPath())
: view('auth.verify');
}
else {
$otpController = new OTPVerificationController;
$otpController->send_code($request->user());
return redirect()->route('verification');
}
}
}
/**
* Resend the email verification notification.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function resend(Request $request)
{
if ($request->user()->hasVerifiedEmail()) {
return redirect($this->redirectPath());
}
$request->user()->sendEmailVerificationNotification();
return back()->with('resent', true);
}
public function verification_confirmation($code){
$user = User::where('verification_code', $code)->first();
if($user != null){
$user->email_verified_at = Carbon::now();
$user->save();
auth()->login($user, true);
flash(translate('Your email has been verified successfully'))->success();
}
else {
flash(translate('Sorry, we could not verifiy you. Please try again'))->error();
}
if($user->user_type == 'seller') {
return redirect()->route('seller.dashboard');
}
return redirect()->route('dashboard');
}
}

View File

@@ -489,11 +489,8 @@ class BusinessSettingsController extends Controller
}
}
elseif ($request->type == 'FILESYSTEM_DRIVER' && $request->value == '1') {
$this->overWriteEnvFile($request->type, 's3');
}
elseif ($request->type == 'FILESYSTEM_DRIVER' && $request->value == '0') {
$this->overWriteEnvFile($request->type, 'local');
elseif ($request->type == 'FILESYSTEM_DRIVER') {
$this->overWriteEnvFile($request->type, $request->value);
}
return '1';

View File

@@ -7,6 +7,7 @@ use App\Models\Product;
use App\Models\Category;
use App\Models\Cart;
use Auth;
use App\Utility\CartUtility;
use Session;
use Cookie;
@@ -14,16 +15,16 @@ class CartController extends Controller
{
public function index(Request $request)
{
if(auth()->user() != null) {
if (auth()->user() != null) {
$user_id = Auth::user()->id;
if($request->session()->get('temp_user_id')) {
if ($request->session()->get('temp_user_id')) {
Cart::where('temp_user_id', $request->session()->get('temp_user_id'))
->update(
[
'user_id' => $user_id,
'temp_user_id' => null
]
);
->update(
[
'user_id' => $user_id,
'temp_user_id' => null
]
);
Session::forget('temp_user_id');
}
@@ -31,7 +32,7 @@ class CartController extends Controller
} else {
$temp_user_id = $request->session()->get('temp_user_id');
// $carts = Cart::where('temp_user_id', $temp_user_id)->get();
$carts = ($temp_user_id != null) ? Cart::where('temp_user_id', $temp_user_id)->get() : [] ;
$carts = ($temp_user_id != null) ? Cart::where('temp_user_id', $temp_user_id)->get() : [];
}
return view('frontend.view_cart', compact('carts'));
@@ -51,72 +52,51 @@ class CartController extends Controller
public function addToCart(Request $request)
{
$carts = Cart::where('user_id', auth()->user()->id)->get();
$check_auction_in_cart = CartUtility::check_auction_in_cart($carts);
$product = Product::find($request->id);
$carts = array();
$data = array();
if($check_auction_in_cart && $product->auction_product == 0) {
return array(
'status' => 0,
'cart_count' => count($carts),
'modal_view' => view('frontend.partials.removeAuctionProductFromCart')->render(),
'nav_cart_view' => view('frontend.partials.cart')->render(),
);
}
$quantity = $request['quantity'];
if(auth()->user() != null) {
$user_id = Auth::user()->id;
$data['user_id'] = $user_id;
$carts = Cart::where('user_id', $user_id)->get();
} else {
if($request->session()->get('temp_user_id')) {
$temp_user_id = $request->session()->get('temp_user_id');
} else {
$temp_user_id = bin2hex(random_bytes(10));
$request->session()->put('temp_user_id', $temp_user_id);
}
$data['temp_user_id'] = $temp_user_id;
$carts = Cart::where('temp_user_id', $temp_user_id)->get();
if ($quantity < $product->min_qty) {
return array(
'status' => 0,
'cart_count' => count($carts),
'modal_view' => view('frontend.partials.minQtyNotSatisfied', ['min_qty' => $product->min_qty])->render(),
'nav_cart_view' => view('frontend.partials.cart')->render(),
);
}
$data['product_id'] = $product->id;
$data['owner_id'] = $product->user_id;
//check the color enabled or disabled for the product
$str = CartUtility::create_cart_variant($product, $request->all());
$product_stock = $product->stocks->where('variant', $str)->first();
$str = '';
$tax = 0;
if($product->auction_product == 0){
if($product->digital != 1 && $request->quantity < $product->min_qty) {
$cart = Cart::firstOrNew([
'variation' => $str,
'user_id' => auth()->user()->id,
'product_id' => $request['id']
]);
if ($cart->exists && $product->digital == 0) {
if ($product->auction_product == 1 && ($cart->product_id == $product->id)) {
return array(
'status' => 0,
'cart_count' => count($carts),
'modal_view' => view('frontend.partials.minQtyNotSatisfied', [ 'min_qty' => $product->min_qty ])->render(),
'modal_view' => view('frontend.partials.auctionProductAlredayAddedCart')->render(),
'nav_cart_view' => view('frontend.partials.cart')->render(),
);
}
//check the color enabled or disabled for the product
if($request->has('color')) {
$str = $request['color'];
}
if ($product->digital != 1) {
//Gets all the choice values of customer choice option and generate a string like Black-S-Cotton
foreach (json_decode($product->choice_options) as $key => $choice) {
if($str != null){
$str .= '-'.str_replace(' ', '', $request['attribute_id_'.$choice->attribute_id]);
}
else{
$str .= str_replace(' ', '', $request['attribute_id_'.$choice->attribute_id]);
}
}
}
$data['variation'] = $str;
$product_stock = $product->stocks->where('variant', $str)->first();
$price = $product_stock->price;
if($product->wholesale_product){
$wholesalePrice = $product_stock->wholesalePrices->where('min_qty', '<=', $request->quantity)->where('max_qty', '>=', $request->quantity)->first();
if($wholesalePrice){
$price = $wholesalePrice->price;
}
}
$quantity = $product_stock->qty;
if($quantity < $request['quantity']) {
if ($product_stock->qty < $cart->quantity + $request['quantity']) {
return array(
'status' => 0,
'cart_count' => count($carts),
@@ -124,164 +104,28 @@ class CartController extends Controller
'nav_cart_view' => view('frontend.partials.cart')->render(),
);
}
//discount calculation
$discount_applicable = false;
if ($product->discount_start_date == null) {
$discount_applicable = true;
}
elseif (strtotime(date('d-m-Y H:i:s')) >= $product->discount_start_date &&
strtotime(date('d-m-Y H:i:s')) <= $product->discount_end_date) {
$discount_applicable = true;
}
if ($discount_applicable) {
if($product->discount_type == 'percent'){
$price -= ($price*$product->discount)/100;
}
elseif($product->discount_type == 'amount'){
$price -= $product->discount;
}
}
//calculation of taxes
foreach ($product->taxes as $product_tax) {
if($product_tax->tax_type == 'percent'){
$tax += ($price * $product_tax->tax) / 100;
}
elseif($product_tax->tax_type == 'amount'){
$tax += $product_tax->tax;
}
}
$data['quantity'] = $request['quantity'];
$data['price'] = $price;
$data['tax'] = $tax;
//$data['shipping'] = 0;
$data['shipping_cost'] = 0;
$data['product_referral_code'] = null;
$data['cash_on_delivery'] = $product->cash_on_delivery;
$data['digital'] = $product->digital;
if ($request['quantity'] == null){
$data['quantity'] = 1;
}
if(Cookie::has('referred_product_id') && Cookie::get('referred_product_id') == $product->id) {
$data['product_referral_code'] = Cookie::get('product_referral_code');
}
if($carts && count($carts) > 0){
$foundInCart = false;
foreach ($carts as $key => $cartItem){
$cart_product = Product::where('id', $cartItem['product_id'])->first();
if($cart_product->auction_product == 1){
return array(
'status' => 0,
'cart_count' => count($carts),
'modal_view' => view('frontend.partials.auctionProductAlredayAddedCart')->render(),
'nav_cart_view' => view('frontend.partials.cart')->render(),
);
}
if($cartItem['product_id'] == $request->id) {
$product_stock = $cart_product->stocks->where('variant', $str)->first();
$quantity = $product_stock->qty;
if($quantity < $cartItem['quantity'] + $request['quantity']){
return array(
'status' => 0,
'cart_count' => count($carts),
'modal_view' => view('frontend.partials.outOfStockCart')->render(),
'nav_cart_view' => view('frontend.partials.cart')->render(),
);
}
if(($str != null && $cartItem['variation'] == $str) || $str == null){
$foundInCart = true;
$cartItem['quantity'] += $request['quantity'];
if($cart_product->wholesale_product){
$wholesalePrice = $product_stock->wholesalePrices->where('min_qty', '<=', $request->quantity)->where('max_qty', '>=', $request->quantity)->first();
if($wholesalePrice){
$price = $wholesalePrice->price;
}
}
$cartItem['price'] = $price;
$cartItem->save();
}
}
}
if (!$foundInCart) {
Cart::create($data);
}
}
else{
Cart::create($data);
}
if(auth()->user() != null) {
$user_id = Auth::user()->id;
$carts = Cart::where('user_id', $user_id)->get();
} else {
$temp_user_id = $request->session()->get('temp_user_id');
$carts = Cart::where('temp_user_id', $temp_user_id)->get();
}
return array(
'status' => 1,
'cart_count' => count($carts),
'modal_view' => view('frontend.partials.addedToCart', compact('product', 'data'))->render(),
'nav_cart_view' => view('frontend.partials.cart')->render(),
);
$quantity = $cart->quantity + $request['quantity'];
}
else{
$price = $product->bids->max('amount');
foreach ($product->taxes as $product_tax) {
if($product_tax->tax_type == 'percent'){
$tax += ($price * $product_tax->tax) / 100;
}
elseif($product_tax->tax_type == 'amount'){
$tax += $product_tax->tax;
}
}
$data['quantity'] = 1;
$data['price'] = $price;
$data['tax'] = $tax;
$data['shipping_cost'] = 0;
$data['product_referral_code'] = null;
$data['cash_on_delivery'] = $product->cash_on_delivery;
$data['digital'] = $product->digital;
if(count($carts) == 0){
Cart::create($data);
}
if(auth()->user() != null) {
$user_id = Auth::user()->id;
$carts = Cart::where('user_id', $user_id)->get();
} else {
$temp_user_id = $request->session()->get('temp_user_id');
$carts = Cart::where('temp_user_id', $temp_user_id)->get();
}
return array(
'status' => 1,
'cart_count' => count($carts),
'modal_view' => view('frontend.partials.addedToCart', compact('product', 'data'))->render(),
'nav_cart_view' => view('frontend.partials.cart')->render(),
);
}
$price = CartUtility::get_price($product, $product_stock, $request->quantity);
$tax = CartUtility::tax_calculation($product, $price);
CartUtility::save_cart_data($cart, $product, $price, $tax, $quantity);
$carts = Cart::where('user_id', auth()->user()->id)->get();
return array(
'status' => 1,
'cart_count' => count($carts),
'modal_view' => view('frontend.partials.addedToCart', compact('product', 'cart'))->render(),
'nav_cart_view' => view('frontend.partials.cart')->render(),
);
}
//removes from Cart
public function removeFromCart(Request $request)
{
Cart::destroy($request->id);
if(auth()->user() != null) {
if (auth()->user() != null) {
$user_id = Auth::user()->id;
$carts = Cart::where('user_id', $user_id)->get();
} else {
@@ -301,41 +145,41 @@ class CartController extends Controller
{
$cartItem = Cart::findOrFail($request->id);
if($cartItem['id'] == $request->id){
if ($cartItem['id'] == $request->id) {
$product = Product::find($cartItem['product_id']);
$product_stock = $product->stocks->where('variant', $cartItem['variation'])->first();
$quantity = $product_stock->qty;
$price = $product_stock->price;
//discount calculation
//discount calculation
$discount_applicable = false;
if ($product->discount_start_date == null) {
$discount_applicable = true;
}
elseif (strtotime(date('d-m-Y H:i:s')) >= $product->discount_start_date &&
strtotime(date('d-m-Y H:i:s')) <= $product->discount_end_date) {
} elseif (
strtotime(date('d-m-Y H:i:s')) >= $product->discount_start_date &&
strtotime(date('d-m-Y H:i:s')) <= $product->discount_end_date
) {
$discount_applicable = true;
}
if ($discount_applicable) {
if($product->discount_type == 'percent'){
$price -= ($price*$product->discount)/100;
}
elseif($product->discount_type == 'amount'){
if ($product->discount_type == 'percent') {
$price -= ($price * $product->discount) / 100;
} elseif ($product->discount_type == 'amount') {
$price -= $product->discount;
}
}
if($quantity >= $request->quantity) {
if($request->quantity >= $product->min_qty){
if ($quantity >= $request->quantity) {
if ($request->quantity >= $product->min_qty) {
$cartItem['quantity'] = $request->quantity;
}
}
if($product->wholesale_product){
if ($product->wholesale_product) {
$wholesalePrice = $product_stock->wholesalePrices->where('min_qty', '<=', $request->quantity)->where('max_qty', '>=', $request->quantity)->first();
if($wholesalePrice){
if ($wholesalePrice) {
$price = $wholesalePrice->price;
}
}
@@ -344,7 +188,7 @@ class CartController extends Controller
$cartItem->save();
}
if(auth()->user() != null) {
if (auth()->user() != null) {
$user_id = Auth::user()->id;
$carts = Cart::where('user_id', $user_id)->get();
} else {

View File

@@ -37,7 +37,7 @@ class CheckoutController extends Controller
$subtotal += cart_product_price($cartItem, $product, false, false) * $cartItem['quantity'];
}
if ($subtotal < get_setting('minimum_order_amount')) {
flash(translate('You order amount is less then the minimum order amount'))->warning();
flash(translate('You order amount is less than the minimum order amount'))->warning();
return redirect()->route('home');
}
}

View File

@@ -7,7 +7,10 @@ use Illuminate\Http\Request;
use App\Models\SellerWithdrawRequest;
use App\Models\Payment;
use App\Models\Shop;
use App\Models\User;
use Session;
use Illuminate\Support\Facades\Notification;
use App\Notifications\PayoutNotification;
class CommissionController extends Controller
{
@@ -77,6 +80,9 @@ class CommissionController extends Controller
$seller_withdraw_request->save();
}
$users = User::findMany([$shop->user->id, User::where('user_type', 'admin')->first()->id]);
Notification::send($users, new PayoutNotification($shop->user, $payment_data['amount'], 'paid'));
Session::forget('payment_data');
Session::forget('payment_type');

View File

@@ -149,7 +149,7 @@ class CustomerPackageController extends Controller
if ($user->customer_package_id != $customer_package->id) {
return $this->purchase_payment_done(Session::get('payment_data'), null);
} else {
flash(translate('You can not purchase this package anymore.'))->warning();
flash(translate('You cannot purchase this package anymore.'))->warning();
return back();
}
}

View File

@@ -4,19 +4,20 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Product;
use App\Models\ProductStock;
use App\Models\Category;
use App\Models\ProductTax;
use App\Models\ProductTranslation;
use App\Models\Upload;
use Artisan;
use App\Services\ProductService;
use App\Services\ProductStockService;
use App\Services\ProductTaxService;
use Auth;
class DigitalProductController extends Controller
{
public function __construct()
{
// Staff Permission Check
$this->middleware(['permission:show_digital_products'])->only('index');
$this->middleware(['permission:add_digital_product'])->only('create');
@@ -33,13 +34,15 @@ class DigitalProductController extends Controller
public function index(Request $request)
{
$sort_search = null;
$products = Product::orderBy('created_at', 'desc');
$products = Product::query();
$products->where('added_by', 'admin');
if ($request->has('search')) {
$sort_search = $request->search;
$products = $products->where('name', 'like', '%' . $sort_search . '%');
}
$products = $products->where('digital', 1)->paginate(10);
return view('backend.product.digital_products.index', compact('products', 'sort_search'));
$products = $products->where('digital', 1)->orderBy('created_at', 'desc')->paginate(10);
$type = 'Admin';
return view('backend.product.digital_products.index', compact('products', 'sort_search', 'type'));
}
/**
@@ -64,66 +67,36 @@ class DigitalProductController extends Controller
*/
public function store(Request $request)
{
$product = new Product;
$product->name = $request->name;
$product->added_by = 'admin';
$product->user_id = Auth::user()->id;
$product->category_id = $request->category_id;
$product->digital = 1;
$product->photos = $request->photos;
$product->thumbnail_img = $request->thumbnail_img;
// Product Store
$product = (new ProductService)->store($request->except([
'_token', 'tax_id', 'tax', 'tax_type'
]));
$tags = array();
if ($request->tags[0] != null) {
foreach (json_decode($request->tags[0]) as $key => $tag) {
array_push($tags, $tag->value);
}
$request->merge(['product_id' => $product->id, 'current_stock' => 0]);
//Product Stock
(new ProductStockService)->store($request->only([
'unit_price', 'current_stock', 'product_id'
]), $product);
//VAT & Tax
if ($request->tax_id) {
(new ProductTaxService)->store($request->only([
'tax_id', 'tax', 'tax_type', 'product_id'
]));
}
$product->tags = implode(',', $tags);
$product->description = $request->description;
$product->unit_price = $request->unit_price;
$product->purchase_price = $request->purchase_price;
$product->discount = $request->discount;
$product->discount_type = $request->discount_type;
// Product Translations
$request->merge(['lang' => env('DEFAULT_LANGUAGE')]);
ProductTranslation::create($request->only([
'lang', 'name', 'unit', 'description', 'product_id'
]));
$product->meta_title = $request->meta_title;
$product->meta_description = $request->meta_description;
$product->meta_img = $request->meta_img;
flash(translate('Product has been inserted successfully'))->success();
$product->file_name = $request->file;
$product->slug = preg_replace('/[^A-Za-z0-9\-]/', '', str_replace(' ', '-', $request->name)) . '-' . rand(10000, 99999);
if ($product->save()) {
$request->merge(['product_id' => $product->id]);
//VAT & Tax
if ($request->tax_id) {
(new ProductTaxService)->store($request->only([
'tax_id', 'tax', 'tax_type', 'product_id'
]));
}
$product_stock = new ProductStock;
$product_stock->product_id = $product->id;
$product_stock->variant = '';
$product_stock->price = $request->unit_price;
$product_stock->sku = '';
$product_stock->qty = 0;
$product_stock->save();
// Product Translations
$product_translation = ProductTranslation::firstOrNew(['lang' => env('DEFAULT_LANGUAGE'), 'product_id' => $product->id]);
$product_translation->name = $request->name;
$product_translation->description = $request->description;
$product_translation->save();
flash(translate('Digital Product has been inserted successfully'))->success();
return redirect()->route('digitalproducts.index');
} else {
flash(translate('Something went wrong'))->error();
return back();
}
Artisan::call('view:clear');
Artisan::call('cache:clear');
return redirect()->route('digitalproducts.index');
}
/**
@@ -164,71 +137,42 @@ class DigitalProductController extends Controller
public function update(Request $request, $id)
{
$product = Product::findOrFail($id);
if ($request->lang == env("DEFAULT_LANGUAGE")) {
$product->name = $request->name;
$product->description = $request->description;
}
$product->category_id = $request->category_id;
$product->digital = 1;
$product->photos = $request->photos;
$product->thumbnail_img = $request->thumbnail_img;
//Product Update
$product = (new ProductService)->update($request->except([
'_token', 'tax_id', 'tax', 'tax_type'
]), $product);
$tags = array();
if ($request->tags[0] != null) {
foreach (json_decode($request->tags[0]) as $key => $tag) {
array_push($tags, $tag->value);
}
}
$product->tags = implode(',', $tags);
$product->unit_price = $request->unit_price;
$product->purchase_price = $request->purchase_price;
$product->discount = $request->discount;
$product->discount_type = $request->discount_type;
$product->meta_title = $request->meta_title;
$product->meta_description = $request->meta_description;
$product->meta_img = $request->meta_img;
$product->slug = strtolower($request->slug);
$product->file_name = $request->file;
// Delete From Product Stock
//Product Stock
foreach ($product->stocks as $key => $stock) {
$stock->delete();
}
if ($product->save()) {
$request->merge(['product_id' => $product->id]);
//VAT & Tax
if ($request->tax_id) {
ProductTax::where('product_id', $product->id)->delete();
(new ProductTaxService)->store($request->only([
'tax_id', 'tax', 'tax_type', 'product_id'
]));
}
// Insert Into Product Stock
$product_stock = new ProductStock;
$product_stock->product_id = $product->id;
$product_stock->variant = '';
$product_stock->price = $request->unit_price;
$product_stock->sku = '';
$product_stock->qty = 0;
$product_stock->save();
$request->merge(['product_id' => $product->id,'current_stock' => 0]);
// Product Translations
$product_translation = ProductTranslation::firstOrNew(['lang' => $request->lang, 'product_id' => $product->id]);
$product_translation->name = $request->name;
$product_translation->description = $request->description;
$product_translation->save();
(new ProductStockService)->store($request->only([
'unit_price', 'current_stock', 'product_id'
]), $product);
flash(translate('Digital Product has been updated successfully'))->success();
return back();
} else {
flash(translate('Something went wrong'))->error();
return back();
//VAT & Tax
if ($request->tax_id) {
ProductTax::where('product_id', $product->id)->delete();
(new ProductTaxService)->store($request->only([
'tax_id', 'tax', 'tax_type', 'product_id'
]));
}
// Product Translations
ProductTranslation::updateOrCreate(
$request->only(['lang', 'product_id']),
$request->only(['name', 'description'])
);
flash(translate('Product has been updated successfully'))->success();
Artisan::call('view:clear');
Artisan::call('cache:clear');
return back();
}
/**
@@ -239,15 +183,16 @@ class DigitalProductController extends Controller
*/
public function destroy($id)
{
$product = Product::findOrFail($id);
$product->product_translations()->delete();
$product->stocks()->delete();
Product::destroy($id);
flash(translate('Product has been deleted successfully'))->success();
return redirect()->route('digitalproducts.index');
$product_destroy = (new ProductService)->destroy($id);
if ($product_destroy) {
flash(translate('Product has been deleted successfully'))->success();
Artisan::call('view:clear');
Artisan::call('cache:clear');
} else {
flash(translate('Something went wrong'))->error();
}
return back();
}

View File

@@ -44,15 +44,50 @@ class HomeController extends Controller
return Category::where('featured', 1)->get();
});
$todays_deal_products = Cache::rememberForever('todays_deal_products', function () {
return filter_products(Product::where('todays_deal', '1'))->get();
});
return view('frontend.index', compact('featured_categories'));
}
public function load_todays_deal_section()
{
$todays_deal_products = filter_products(Product::where('todays_deal', '1'))->get();
// dd($todays_deal_products);
return view('frontend.partials.todays_deal', compact('todays_deal_products'));
}
public function load_newest_product_section()
{
$newest_products = Cache::remember('newest_products', 3600, function () {
return filter_products(Product::latest())->limit(12)->get();
});
return view('frontend.partials.newest_products_section', compact('newest_products'));
}
return view('frontend.index', compact('featured_categories', 'todays_deal_products', 'newest_products'));
public function load_featured_section()
{
return view('frontend.partials.featured_products_section');
}
public function load_best_selling_section()
{
return view('frontend.partials.best_selling_section');
}
public function load_auction_products_section()
{
if (!addon_is_activated('auction')) {
return;
}
return view('auction.frontend.auction_products_section');
}
public function load_home_categories_section()
{
return view('frontend.partials.home_categories_section');
}
public function load_best_sellers_section()
{
return view('frontend.partials.best_sellers_section');
}
public function login()
@@ -69,29 +104,29 @@ class HomeController extends Controller
return view('frontend.user_login');
}
// public function registration(Request $request)
// {
// if (Auth::check()) {
// return redirect()->route('home');
// }
// if ($request->has('referral_code') && addon_is_activated('affiliate_system')) {
// try {
// $affiliate_validation_time = AffiliateConfig::where('type', 'validation_time')->first();
// $cookie_minute = 30 * 24;
// if ($affiliate_validation_time) {
// $cookie_minute = $affiliate_validation_time->value * 60;
// }
public function registration(Request $request)
{
if (Auth::check()) {
return redirect()->route('home');
}
if ($request->has('referral_code') && addon_is_activated('affiliate_system')) {
try {
$affiliate_validation_time = AffiliateConfig::where('type', 'validation_time')->first();
$cookie_minute = 30 * 24;
if ($affiliate_validation_time) {
$cookie_minute = $affiliate_validation_time->value * 60;
}
// Cookie::queue('referral_code', $request->referral_code, $cookie_minute);
// $referred_by_user = User::where('referral_code', $request->referral_code)->first();
Cookie::queue('referral_code', $request->referral_code, $cookie_minute);
$referred_by_user = User::where('referral_code', $request->referral_code)->first();
// $affiliateController = new AffiliateController;
// $affiliateController->processAffiliateStats($referred_by_user->id, 1, 0, 0, 0);
// } catch (\Exception $e) {
// }
// }
// return view('frontend.user_registration');
// }
$affiliateController = new AffiliateController;
$affiliateController->processAffiliateStats($referred_by_user->id, 1, 0, 0, 0);
} catch (\Exception $e) {
}
}
return view('frontend.user_registration');
}
public function cart_login(Request $request)
{
@@ -133,9 +168,6 @@ class HomeController extends Controller
*
* @return \Illuminate\Http\Response
*/
//AQUI AGREGO LOS DIFERENTES TIPOS DE USUARIOS
public function dashboard()
{
if (Auth::user()->user_type == 'seller') {
@@ -148,8 +180,6 @@ class HomeController extends Controller
return view('frontend.user.customer.dashboard');
} elseif (Auth::user()->user_type == 'delivery_boy') {
return view('delivery_boys.dashboard');
} elseif (Auth::user()->user_type == 'repair') {
return view('workshop.dashboard');
} else {
abort(404);
}
@@ -202,34 +232,6 @@ class HomeController extends Controller
}
}
public function load_featured_section()
{
return view('frontend.partials.featured_products_section');
}
public function load_best_selling_section()
{
return view('frontend.partials.best_selling_section');
}
public function load_auction_products_section()
{
if (!addon_is_activated('auction')) {
return;
}
return view('auction.frontend.auction_products_section');
}
public function load_home_categories_section()
{
return view('frontend.partials.home_categories_section');
}
public function load_best_sellers_section()
{
return view('frontend.partials.best_sellers_section');
}
public function trackOrder(Request $request)
{
if ($request->has('order_code')) {
@@ -595,37 +597,37 @@ class HomeController extends Controller
return back();
}
// public function send_email_change_verification_mail($request, $email)
// {
// $response['status'] = 0;
// $response['message'] = 'Unknown';
public function send_email_change_verification_mail($request, $email)
{
$response['status'] = 0;
$response['message'] = 'Unknown';
// $verification_code = Str::random(32);
$verification_code = Str::random(32);
// $array['subject'] = translate('Email Verification');
// $array['from'] = env('MAIL_FROM_ADDRESS');
// $array['content'] = translate('Verify your account');
// $array['link'] = route('email_change.callback') . '?new_email_verificiation_code=' . $verification_code . '&email=' . $email;
// $array['sender'] = Auth::user()->name;
// $array['details'] = translate("Email Second");
$array['subject'] = translate('Email Verification');
$array['from'] = env('MAIL_FROM_ADDRESS');
$array['content'] = translate('Verify your account');
$array['link'] = route('email_change.callback') . '?new_email_verificiation_code=' . $verification_code . '&email=' . $email;
$array['sender'] = Auth::user()->name;
$array['details'] = translate("Email Second");
// $user = Auth::user();
// $user->new_email_verificiation_code = $verification_code;
// $user->save();
$user = Auth::user();
$user->new_email_verificiation_code = $verification_code;
$user->save();
// try {
// Mail::to($email)->queue(new SecondEmailVerifyMailManager($array));
try {
Mail::to($email)->queue(new SecondEmailVerifyMailManager($array));
// $response['status'] = 1;
// $response['message'] = translate("Your verification mail has been Sent to your email.");
// } catch (\Exception $e) {
// // return $e->getMessage();
// $response['status'] = 0;
// $response['message'] = $e->getMessage();
// }
$response['status'] = 1;
$response['message'] = translate("Your verification mail has been Sent to your email.");
} catch (\Exception $e) {
// return $e->getMessage();
$response['status'] = 0;
$response['message'] = $e->getMessage();
}
// return $response;
// }
return $response;
}
public function email_change_callback(Request $request)
{
@@ -697,7 +699,7 @@ class HomeController extends Controller
public function todays_deal()
{
$todays_deal_products = Cache::rememberForever('todays_deal_products', function () {
return filter_products(Product::where('todays_deal', '1'))->get();
return filter_products(Product::with('thumbnail')->where('todays_deal', '1'))->get();
});
return view("frontend.todays_deal", compact('todays_deal_products'));

View File

@@ -85,10 +85,10 @@ class LanguageController extends Controller
}
$language = Language::findOrFail($id);
if (env('DEFAULT_LANGUAGE') == $language->code && env('DEFAULT_LANGUAGE') != $request->code) {
flash(translate('Default language code can not be edited'))->error();
flash(translate('Default language code cannot be edited'))->error();
return back();
} elseif ($language->code == 'en' && $request->code != 'en') {
flash(translate('English language code can not be edited'))->error();
flash(translate('English language code cannot be edited'))->error();
return back();
}
@@ -129,7 +129,7 @@ class LanguageController extends Controller
{
$language = Language::findOrFail($request->id);
if($language->code == env('DEFAULT_LANGUAGE') && $request->status == 0) {
flash(translate('Default language can not be inactive'))->error();
flash(translate('Default language cannot be inactive'))->error();
return 1;
}
$language->status = $request->status;
@@ -155,9 +155,9 @@ class LanguageController extends Controller
{
$language = Language::findOrFail($id);
if (env('DEFAULT_LANGUAGE') == $language->code) {
flash(translate('Default language can not be deleted'))->error();
flash(translate('Default language cannot be deleted'))->error();
} elseif($language->code == 'en') {
flash(translate('English language can not be deleted'))->error();
flash(translate('English language cannot be deleted'))->error();
}
else {
if($language->code == Session::get('locale')){

View File

@@ -77,7 +77,7 @@ class RazorpayController extends Controller
$response = $api->payment->fetch($input['razorpay_payment_id'])->capture(array('amount' => $payment['amount']));
$payment_detalis = json_encode(array('id' => $response['id'], 'method' => $response['method'], 'amount' => $response['amount'], 'currency' => $response['currency']));
} catch (\Exception $e) {
return $e->getMessage();
// return $e->getMessage();
\Session::put('error', $e->getMessage());
return redirect()->back();
}

View File

@@ -11,6 +11,9 @@ use App\Models\Category;
use App\Models\ProductTax;
use App\Models\AttributeValue;
use App\Models\Cart;
use App\Models\Wishlist;
use App\Models\User;
use App\Notifications\ShopProductNotification;
use Carbon\Carbon;
use Combinations;
use CoreComponentRepository;
@@ -21,6 +24,7 @@ use App\Services\ProductService;
use App\Services\ProductTaxService;
use App\Services\ProductFlashDealService;
use App\Services\ProductStockService;
use Illuminate\Support\Facades\Notification;
class ProductController extends Controller
{
@@ -91,7 +95,7 @@ class ProductController extends Controller
*
* @return \Illuminate\Http\Response
*/
public function seller_products(Request $request)
public function seller_products(Request $request, $product_type)
{
$col_name = null;
$query = null;
@@ -114,11 +118,16 @@ class ProductController extends Controller
$products = $products->orderBy($col_name, $query);
$sort_type = $request->type;
}
$products = $products->where('digital', 0)->orderBy('created_at', 'desc')->paginate(15);
$products = $product_type == 'physical' ? $products->where('digital', 0) : $products->where('digital', 1);
$products = $products->orderBy('created_at', 'desc')->paginate(15);
$type = 'Seller';
if($product_type == 'digital'){
return view('backend.product.digital_products.index', compact('products', 'sort_search', 'type'));
}
return view('backend.product.products.index', compact('products', 'type', 'col_name', 'query', 'seller_id', 'sort_search'));
}
public function all_products(Request $request)
@@ -127,7 +136,7 @@ class ProductController extends Controller
$query = null;
$seller_id = null;
$sort_search = null;
$products = Product::orderBy('created_at', 'desc')->where('auction_product', 0)->where('wholesale_product', 0);
$products = Product::where('auction_product', 0)->where('wholesale_product', 0);
if ($request->has('user_id') && $request->user_id != null) {
$products = $products->where('user_id', $request->user_id);
$seller_id = $request->user_id;
@@ -148,7 +157,7 @@ class ProductController extends Controller
$sort_type = $request->type;
}
$products = $products->paginate(15);
$products = $products->orderBy('created_at', 'desc')->paginate(15);
$type = 'All';
return view('backend.product.products.index', compact('products', 'type', 'col_name', 'query', 'seller_id', 'sort_search'));
@@ -358,6 +367,7 @@ class ProductController extends Controller
if (Product::destroy($id)) {
Cart::where('product_id', $id)->delete();
Wishlist::where('product_id', $id)->delete();
flash(translate('Product has been deleted successfully'))->success();
@@ -466,6 +476,11 @@ class ProductController extends Controller
$product->save();
$product_type = $product->digital == 0 ? 'physical' : 'digital';
$status = $request->approved == 1 ? 'approved' : 'rejected';
$users = User::findMany([User::where('user_type', 'admin')->first()->id, $product->user_id]);
Notification::send($users, new ShopProductNotification($product_type, $product, $status));
Artisan::call('view:clear');
Artisan::call('cache:clear');
return 1;

View File

@@ -2,11 +2,14 @@
namespace App\Http\Controllers;
use App\Models\Cart;
use DB;
use Auth;
use App\Models\Order;
use App\Models\Upload;
use App\Models\Product;
use App\Utility\CartUtility;
use Cookie;
use Illuminate\Http\Request;
class PurchaseHistoryController extends Controller
@@ -25,14 +28,14 @@ class PurchaseHistoryController extends Controller
public function digital_index()
{
$orders = DB::table('orders')
->orderBy('code', 'desc')
->join('order_details', 'orders.id', '=', 'order_details.order_id')
->join('products', 'order_details.product_id', '=', 'products.id')
->where('orders.user_id', Auth::user()->id)
->where('products.digital', '1')
->where('order_details.payment_status', 'paid')
->select('order_details.id')
->paginate(15);
->orderBy('code', 'desc')
->join('order_details', 'orders.id', '=', 'order_details.order_id')
->join('products', 'order_details.product_id', '=', 'products.id')
->where('orders.user_id', Auth::user()->id)
->where('products.digital', '1')
->where('order_details.payment_status', 'paid')
->select('order_details.id')
->paginate(15);
return view('frontend.user.digital_purchase_history', compact('orders'));
}
@@ -67,7 +70,7 @@ class PurchaseHistoryController extends Controller
}
}
} else {
flash(translate('You cannot download this product at this product.'))->success();
flash(translate('You cannot download this product.'))->success();
}
}
@@ -80,7 +83,7 @@ class PurchaseHistoryController extends Controller
public function order_cancel($id)
{
$order = Order::where('id', $id)->where('user_id', auth()->user()->id)->first();
if($order && ($order->delivery_status == 'pending' && $order->payment_status == 'unpaid')) {
if ($order && ($order->delivery_status == 'pending' && $order->payment_status == 'unpaid')) {
$order->delivery_status = 'cancelled';
$order->save();
@@ -97,4 +100,87 @@ class PurchaseHistoryController extends Controller
return back();
}
public function re_order($id)
{
$user_id = Auth::user()->id;
// if Cart has auction product check
$carts = Cart::where('user_id', $user_id)->get();
foreach ($carts as $cartItem) {
$cart_product = Product::where('id', $cartItem['product_id'])->first();
if ($cart_product->auction_product == 1) {
flash(translate('Remove auction product from cart to add products.'))->error();
return back();
}
}
$order = Order::findOrFail(decrypt($id));
$success_msgs = [];
$failed_msgs = [];
$data['user_id'] = $user_id;
foreach ($order->orderDetails as $key => $orderDetail) {
$product = $orderDetail->product;
if (
!$product || $product->published == 0 ||
$product->approved == 0 || ($product->wholesale_product && !addon_is_activated("wholesale"))
) {
array_push($failed_msgs, translate('An item from this order is not available now.'));
continue;
}
if ($product->auction_product == 0) {
// If product min qty is greater then the ordered qty, then update the order qty
$order_qty = $orderDetail->quantity;
if ($product->digital == 0 && $order_qty < $product->min_qty) {
$order_qty = $product->min_qty;
}
$cart = Cart::firstOrNew([
'variation' => $orderDetail->variation,
'user_id' => auth()->user()->id,
'product_id' => $product->id
]);
$product_stock = $product->stocks->where('variant', $orderDetail->variation)->first();
if ($product_stock) {
$quantity = 1;
if ($product->digital != 1) {
$quantity = $product_stock->qty;
if ($quantity > 0) {
if ($cart->exists) {
$order_qty = $cart->quantity + $order_qty;
}
//If order qty is greater then the product stock, set order qty = current product stock qty
$quantity = $quantity >= $order_qty ? $order_qty : $quantity;
} else {
array_push($failed_msgs, $product->getTranslation('name') . ' ' . translate(' is stock out.'));
continue;
}
}
$price = CartUtility::get_price($product, $product_stock, $quantity);
$tax = CartUtility::tax_calculation($product, $price);
CartUtility::save_cart_data($cart, $product, $price, $tax, $quantity);
array_push($success_msgs, $product->getTranslation('name') . ' ' . translate('added to cart.'));
} else {
array_push($failed_msgs, $product->getTranslation('name') . ' ' . translate('is stock out.'));
}
} else {
array_push($failed_msgs, translate('You can not re order an auction product.'));
break;
}
}
foreach ($failed_msgs as $msg) {
flash($msg)->warning();
}
foreach ($success_msgs as $msg) {
flash($msg)->success();
}
return redirect()->route('cart');
}
}

View File

@@ -89,7 +89,7 @@ class AddressController extends Controller
$address->delete();
return back();
}
flash(translate('Default address can not be deleted'))->warning();
flash(translate('Default address cannot be deleted'))->warning();
return back();
}

View File

@@ -4,14 +4,22 @@ namespace App\Http\Controllers\Seller;
use Illuminate\Http\Request;
use App\Models\Product;
use App\Models\ProductStock;
use App\Models\Category;
use App\Models\ProductStock;
use App\Models\ProductTax;
use App\Models\ProductTranslation;
use App\Models\Upload;
use Artisan;
use App\Models\User;
use App\Services\ProductTaxService;
use App\Notifications\ShopProductNotification;
use Illuminate\Support\Facades\Notification;
use Auth;
use App\Services\ProductService;
use App\Services\ProductStockService;
class DigitalProductController extends Controller
{
/**
@@ -60,33 +68,34 @@ class DigitalProductController extends Controller
return redirect()->route('seller.digitalproducts');
}
}
// Product Store
$product = (new ProductService)->store($request->except([
'_token', 'tax_id', 'tax', 'tax_type'
]));
$product = new Product;
$product->name = $request->name;
$product->added_by = 'seller';
$product->user_id = Auth::user()->id;
$product->category_id = $request->category_id;
$product->digital = 1;
$product->photos = $request->photos;
$product->thumbnail_img = $request->thumbnail_img;
$request->merge(['product_id' => $product->id, 'current_stock' => 0]);
$tags = array();
if($request->tags[0] != null){
foreach (json_decode($request->tags[0]) as $key => $tag) {
array_push($tags, $tag->value);
}
//Product Stock
(new ProductStockService)->store($request->only([
'unit_price', 'current_stock', 'product_id'
]), $product);
//VAT & Tax
if ($request->tax_id) {
(new ProductTaxService)->store($request->only([
'tax_id', 'tax', 'tax_type', 'product_id'
]));
}
$product->tags = implode(',', $tags);
$product->description = $request->description;
$product->unit_price = $request->unit_price;
$product->purchase_price = $request->purchase_price;
$product->discount = $request->discount;
$product->discount_type = $request->discount_type;
// Product Translations
$request->merge(['lang' => env('DEFAULT_LANGUAGE')]);
ProductTranslation::create($request->only([
'lang', 'name', 'unit', 'description', 'product_id'
]));
flash(translate('Product has been inserted successfully'))->success();
$product->meta_title = $request->meta_title;
$product->meta_description = $request->meta_description;
$product->meta_img = $request->meta_img;
$product->file_name = $request->file;
@@ -101,7 +110,7 @@ class DigitalProductController extends Controller
]));
}
$product_stock = new ProductStock;
$product_stock = new ProductStock();
$product_stock->product_id = $product->id;
$product_stock->variant = '';
$product_stock->price = $request->unit_price;
@@ -115,13 +124,21 @@ class DigitalProductController extends Controller
$product_translation->description = $request->description;
$product_translation->save();
if(get_setting('product_approve_by_admin') == 1){
$users = User::findMany([auth()->user()->id, User::where('user_type', 'admin')->first()->id]);
Notification::send($users, new ShopProductNotification('digital', $product));
}
flash(translate('Digital Product has been inserted successfully'))->success();
Artisan::call('view:clear');
Artisan::call('cache:clear');
return redirect()->route('seller.digitalproducts');
}
else{
flash(translate('Something went wrong'))->error();
return back();
}
}
/**
@@ -145,84 +162,44 @@ class DigitalProductController extends Controller
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
public function update(Request $request, Product $product)
{
$product = Product::findOrFail($id);
if($request->lang == env("DEFAULT_LANGUAGE")){
$product->name = $request->name;
$product->description = $request->description;
}
//Product Update
$product = (new ProductService)->update($request->except([
'_token', 'tax_id', 'tax', 'tax_type'
]), $product);
$product->category_id = $request->category_id;
$product->photos = $request->photos;
$product->thumbnail_img = $request->thumbnail_img;
$tags = array();
if($request->tags[0] != null){
foreach (json_decode($request->tags[0]) as $key => $tag) {
array_push($tags, $tag->value);
}
}
$product->tags = implode(',', $tags);
$product->unit_price = $request->unit_price;
$product->purchase_price = $request->purchase_price;
$product->discount = $request->discount;
$product->discount_type = $request->discount_type;
$product->meta_title = $request->meta_title;
$product->meta_description = $request->meta_description;
$product->meta_img = $request->meta_img;
$product->slug = strtolower($request->slug);
// if($request->hasFile('file')){
// $product->file_name = $request->file('file')->getClientOriginalName();
// $product->file_path = $request->file('file')->store('uploads/products/digital');
// }
$product->file_name = $request->file;
// Delete From Product Stock
//Product Stock
foreach ($product->stocks as $key => $stock) {
$stock->delete();
}
if($product->save()){
$request->merge(['product_id' => $product->id]);
//VAT & Tax
if ($request->tax_id) {
ProductTax::where('product_id', $product->id)->delete();
(new ProductTaxService)->store($request->only([
'tax_id', 'tax', 'tax_type', 'product_id'
]));
}
// Insert Into Product Stock
$product_stock = new ProductStock;
$product_stock->product_id = $product->id;
$product_stock->variant = '';
$product_stock->price = $request->unit_price;
$product_stock->sku = '';
$product_stock->qty = 0;
$product_stock->save();
// Product Translations
$product_translation = ProductTranslation::firstOrNew(['lang' => $request->lang, 'product_id' => $product->id]);
$product_translation->name = $request->name;
$product_translation->description = $request->description;
$product_translation->save();
flash(translate('Digital Product has been updated successfully'))->success();
if(Auth::user()->user_type == 'admin' || Auth::user()->user_type == 'staff'){
return back();
}
else{
return back();
}
}
else{
flash(translate('Something went wrong'))->error();
return back();
$request->merge(['product_id' => $product->id,'current_stock' => 0]);
(new ProductStockService)->store($request->only([
'unit_price', 'current_stock', 'product_id'
]), $product);
//VAT & Tax
if ($request->tax_id) {
ProductTax::where('product_id', $product->id)->delete();
(new ProductTaxService)->store($request->only([
'tax_id', 'tax', 'tax_type', 'product_id'
]));
}
// Product Translations
ProductTranslation::updateOrCreate(
$request->only(['lang', 'product_id']),
$request->only(['name', 'description'])
);
flash(translate('Product has been updated successfully'))->success();
Artisan::call('view:clear');
Artisan::call('cache:clear');
return back();
}
/**
@@ -233,15 +210,16 @@ class DigitalProductController extends Controller
*/
public function destroy($id)
{
$product = Product::findOrFail($id);
$product->product_translations()->delete();
$product->stocks()->delete();
Product::destroy($id);
flash(translate('Product has been deleted successfully'))->success();
return redirect()->route('seller.digitalproducts');
$product_destroy = (new ProductService)->destroy($id);
if ($product_destroy) {
flash(translate('Product has been deleted successfully'))->success();
Artisan::call('view:clear');
Artisan::call('cache:clear');
} else {
flash(translate('Something went wrong'))->error();
}
return back();
}

View File

@@ -11,6 +11,9 @@ use App\Models\Category;
use App\Models\Product;
use App\Models\ProductTax;
use App\Models\ProductTranslation;
use App\Models\Wishlist;
use App\Models\User;
use App\Notifications\ShopProductNotification;
use Carbon\Carbon;
use Combinations;
use Artisan;
@@ -21,6 +24,7 @@ use App\Services\ProductService;
use App\Services\ProductTaxService;
use App\Services\ProductFlashDealService;
use App\Services\ProductStockService;
use Illuminate\Support\Facades\Notification;
class ProductController extends Controller
{
@@ -55,15 +59,8 @@ class ProductController extends Controller
public function create(Request $request)
{
if (addon_is_activated('seller_subscription')) {
if (seller_package_validity_check()) {
$categories = Category::where('parent_id', 0)
->where('digital', 0)
->with('childrenCategories')
->get();
return view('seller.product.products.create', compact('categories'));
} else {
if (!seller_package_validity_check()) {
flash(translate('Please upgrade your package.'))->warning();
return back();
}
@@ -107,6 +104,11 @@ class ProductController extends Controller
'lang', 'name', 'unit', 'description', 'product_id'
]));
if(get_setting('product_approve_by_admin') == 1){
$users = User::findMany([auth()->user()->id, User::where('user_type', 'admin')->first()->id]);
Notification::send($users, new ShopProductNotification('physical', $product));
}
flash(translate('Product has been inserted successfully'))->success();
Artisan::call('view:clear');
@@ -254,11 +256,7 @@ class ProductController extends Controller
$product->published = $request->status;
if (addon_is_activated('seller_subscription') && $request->status == 1) {
$shop = $product->user->shop;
if (
$shop->package_invalid_at == null
|| Carbon::now()->diffInDays(Carbon::parse($shop->package_invalid_at), false) < 0
|| $shop->product_upload_limit <= $shop->user->products()->where('published', 1)->count()
) {
if (!seller_package_validity_check()) {
return 2;
}
}
@@ -323,6 +321,7 @@ class ProductController extends Controller
if (Product::destroy($id)) {
Cart::where('product_id', $id)->delete();
Wishlist::where('product_id', $id)->delete();
flash(translate('Product has been deleted successfully'))->success();

View File

@@ -3,7 +3,10 @@
namespace App\Http\Controllers\Seller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Notification;
use App\Notifications\PayoutNotification;
use App\Models\SellerWithdrawRequest;
use App\Models\User;
use Auth;
class SellerWithdrawRequestController extends Controller
@@ -35,6 +38,10 @@ class SellerWithdrawRequestController extends Controller
$seller_withdraw_request->status = '0';
$seller_withdraw_request->viewed = '0';
if ($seller_withdraw_request->save()) {
$users = User::findMany([auth()->user()->id, User::where('user_type', 'admin')->first()->id]);
Notification::send($users, new PayoutNotification(Auth::user(), $request->amount, 'pending'));
flash(translate('Request has been sent successfully'))->success();
return redirect()->route('seller.money_withdraw_requests.index');
}

View File

@@ -5,7 +5,10 @@ namespace App\Http\Controllers\Seller;
use App\Models\BusinessSetting;
use Illuminate\Http\Request;
use App\Models\Shop;
use App\Models\User;
use App\Notifications\ShopVerificationNotification;
use Auth;
use Illuminate\Support\Facades\Notification;
class ShopController extends Controller
{
@@ -51,9 +54,9 @@ class ShopController extends Controller
$shop->youtube = $request->youtube;
} elseif (
$request->has('top_banner') ||
$request->has('sliders') ||
$request->has('banner_full_width_1') ||
$request->has('banners_half_width') ||
$request->has('sliders') ||
$request->has('banner_full_width_1') ||
$request->has('banners_half_width') ||
$request->has('banner_full_width_2')
) {
$shop->top_banner = $request->top_banner;
@@ -72,7 +75,7 @@ class ShopController extends Controller
return back();
}
public function verify_form ()
public function verify_form()
{
if (Auth::user()->shop->verification_info == null) {
$shop = Auth::user()->shop;
@@ -112,6 +115,9 @@ class ShopController extends Controller
$shop = Auth::user()->shop;
$shop->verification_info = json_encode($data);
if ($shop->save()) {
$users = User::findMany([auth()->user()->id, User::where('user_type', 'admin')->first()->id]);
Notification::send($users, new ShopVerificationNotification($shop));
flash(translate('Your shop verification request has been submitted successfully!'))->success();
return redirect()->route('seller.dashboard');
}

View File

@@ -11,11 +11,14 @@ use App\Models\Order;
use App\Models\OrderDetail;
use Illuminate\Support\Facades\Hash;
use App\Notifications\EmailVerificationNotification;
use App\Notifications\ShopVerificationNotification;
use Cache;
use Illuminate\Support\Facades\Notification;
class SellerController extends Controller
{
public function __construct() {
public function __construct()
{
// Staff Permission Check
$this->middleware(['permission:view_all_seller'])->only('index');
$this->middleware(['permission:view_seller_profile'])->only('profile_modal');
@@ -36,9 +39,9 @@ class SellerController extends Controller
$sort_search = null;
$approved = null;
$shops = Shop::whereIn('user_id', function ($query) {
$query->select('id')
->from(with(new User)->getTable());
})->latest();
$query->select('id')
->from(with(new User)->getTable());
})->latest();
if ($request->has('search')) {
$sort_search = $request->search;
@@ -209,13 +212,14 @@ class SellerController extends Controller
{
$shop = Shop::findOrFail($id);
$shop->verification_status = 1;
if ($shop->save()) {
Cache::forget('verified_sellers_id');
flash(translate('Seller has been approved successfully'))->success();
return redirect()->route('sellers.index');
}
flash(translate('Something went wrong'))->error();
return back();
$shop->save();
Cache::forget('verified_sellers_id');
$users = User::findMany([$shop->user->id, User::where('user_type', 'admin')->first()->id]);
Notification::send($users, new ShopVerificationNotification($shop, 'approved'));
flash(translate('Seller has been approved successfully'))->success();
return redirect()->route('sellers.index');
}
public function reject_seller($id)
@@ -223,13 +227,14 @@ class SellerController extends Controller
$shop = Shop::findOrFail($id);
$shop->verification_status = 0;
$shop->verification_info = null;
if ($shop->save()) {
Cache::forget('verified_sellers_id');
flash(translate('Seller verification request has been rejected successfully'))->success();
return redirect()->route('sellers.index');
}
flash(translate('Something went wrong'))->error();
return back();
$shop->save();
Cache::forget('verified_sellers_id');
$users = User::findMany([$shop->user->id, User::where('user_type', 'admin')->first()->id]);
Notification::send($users, new ShopVerificationNotification($shop, 'rejected'));
flash(translate('Seller verification request has been rejected successfully'))->success();
return redirect()->route('sellers.index');
}
@@ -249,11 +254,13 @@ class SellerController extends Controller
{
$shop = Shop::findOrFail($request->id);
$shop->verification_status = $request->status;
if ($shop->save()) {
Cache::forget('verified_sellers_id');
return 1;
}
return 0;
$shop->save();
Cache::forget('verified_sellers_id');
$status = $request->status == 1 ? 'approved' : 'rejected';
$users = User::findMany([$shop->user->id, User::where('user_type', 'admin')->first()->id]);
Notification::send($users, new ShopVerificationNotification($shop, $status));
return 1;
}
public function login($id)

View File

@@ -10,6 +10,7 @@ use App\Models\BusinessSetting;
use Auth;
use Hash;
use App\Notifications\EmailVerificationNotification;
use Illuminate\Support\Facades\Notification;
class ShopController extends Controller
{
@@ -27,8 +28,6 @@ class ShopController extends Controller
public function index()
{
$shop = Auth::user()->shop;
/* by joan */
return view('seller.shop', compact('shop'));
}
@@ -41,7 +40,7 @@ class ShopController extends Controller
{
if (Auth::check()) {
if((Auth::user()->user_type == 'admin' || Auth::user()->user_type == 'customer')) {
flash(translate('Admin or Customer can not be a seller'))->error();
flash(translate('Admin or Customer cannot be a seller'))->error();
return back();
} if(Auth::user()->user_type == 'seller'){
flash(translate('This user already a seller'))->error();
@@ -72,11 +71,11 @@ class ShopController extends Controller
$shop->user_id = $user->id;
$shop->name = $request->shop_name;
$shop->address = $request->address;
$shop->slug = preg_replace('/\s+/', '-', str_replace("/"," ", $request->shop_name));
$shop->slug = preg_replace('/\s+/', '-', str_replace("/", " ", $request->shop_name));
$shop->save();
auth()->login($user, false);
if (BusinessSetting::where('type', 'email_verification')->first()->value != 1) {
if (BusinessSetting::where('type', 'email_verification')->first()->value == 0) {
$user->email_verified_at = date('Y-m-d H:m:s');
$user->save();
} else {

View File

@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Mail\VerificationEmail;
use App\Models\Category;
use App\Models\CategoryTranslation;
use App\Models\Shop;
use App\Models\User;
use Illuminate\Http\Request;
@@ -25,9 +26,12 @@ class TypeBusinessController extends Controller
public function index()
{
$categories = Category::all();
$categories = CategoryTranslation::all();
return view('frontend.registro-comercio.views.business.index', compact('categories'));
$apiKey = env('GOOGLE_MAPS_API_KEY');
return view('frontend.registro-comercio.views.business.index', compact('categories', 'apiKey'));
}
@@ -47,49 +51,100 @@ class TypeBusinessController extends Controller
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request, User $user)
public function store(Request $request, User $user, Shop $shop)
{
// Validación de los campos de registro
$validator = Validator::make($request->all(), [
// $validator = Validator::make($request->all(), [
// 'name' => ['required'],
// 'address' => ['required'],
// 'categories_id' => ['required'],
// 'email' => ['required', 'string', 'email', 'max:255', 'unique:'.User::class, 'regex:/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+.(com|do|net|com.do)$/'],
// 'password' => ['required', 'confirmed', Password::defaults()],
// 'terms' => ['required'], // Agrega esta línea para hacer el campo 'terms' requerido
// 'g-recaptcha-response' => ['required', function ($attribute, $value, $fail) {
// $recaptcha = new Recaptcha(env('RECAPTCHA_SECRET_KEY'));
// $recaptcha->verify($value);
// }],
// ]);
$validator = Validator::make($request->all(), [
'name_user' => ['required'],
'name' => ['required'],
'address' => ['required'],
'categories_id' => ['required'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:'.User::class, 'regex:/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+.(com|do|net|com.do)$/'],
'email' => [
'required',
'string',
'email',
'max:255',
'unique:'.User::class,
//VALIDA EL TIPO DE extencion del dominio permitido
'regex:/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+.(com|do|net|com.do)$/',
//valida si el correo existe, a traves de los dns
//La función filter_var($value, FILTER_VALIDATE_EMAIL) verifica si la cadena de correo electrónico es una dirección de correo electrónico válida según el filtro FILTER_VALIDATE_EMAIL de PHP.
//La función checkdnsrr($domain, 'MX') verifica si el dominio del correo electrónico tiene registros MX en el sistema de nombres de dominio (DNS). Esto se hace utilizando la función checkdnsrr de PHP con el tipo de registro 'MX'.
//Los tipos de registro DNS válidos son: 'A', 'MX', 'NS', 'SOA', 'PTR', 'CNAME', 'AAAA', 'A6', 'SRV', 'NAPTR', 'TXT', 'ANY'.
function ($attribute, $value, $fail) {
$domain = explode('@', $value)[1];
if (!filter_var($value, FILTER_VALIDATE_EMAIL) || !checkdnsrr($domain, 'MX')) {
$fail('El correo electrónico no existe.');
}
},
],
'password' => ['required', 'confirmed', Password::defaults()],
'terms' => ['required'], // Agrega esta línea para hacer el campo 'terms' requerido
'g-recaptcha-response' => ['required', function ($attribute, $value, $fail) {
$recaptcha = new Recaptcha(env('RECAPTCHA_SECRET_KEY'));
$recaptcha->verify($value);
}],
'terms' => ['required'],
'g-recaptcha-response' => [
'required',
function ($attribute, $value, $fail) {
$recaptcha = new Recaptcha(env('RECAPTCHA_SECRET_KEY'));
$recaptcha->verify($value);
},
],
]);
// if ($validator->fails()) {
// // Si la validación falla, puedes redirigir o devolver una respuesta con los errores
// return redirect()->back()->withErrors($validator)->withInput();
// }
if ($validator->fails()) {
// Si la validación falla, puedes redirigir o devolver una respuesta con los errores
return redirect()->back()->withErrors($validator)->withInput();
}
// $confirmation_code = Str::random(25);
$confirmation_code = Str::random(25);
// $user = new User();
// $user->email = $request->input('email');
// $user->password = Hash::make($request->input('password'));
// $user->user_type = 'seller';
// $user->confirmation_code = $confirmation_code;
// $user->save();
$user = new User();
$user->name = $request->input('name_user');
$user->email = $request->input('email');
$user->password = Hash::make($request->input('password'));
$user->user_type = 'seller';
$user->confirmation_code = $confirmation_code;
$user->category_translation_id = $request->input('categories_id');
$user->save();
// Guardar los campos en el modelo Shop
$shop->user_id = $user->id;
$shop->name = $request->name;
$shop->slug = Str::slug($request->name); // Genera el slug a partir del nombre
$shop->address = $request->address;
$shop->delivery_pickup_latitude = $request->latitude;
$shop->delivery_pickup_longitude = $request->longitude;
// Aquí puedes guardar otros campos si los tienes
// Guardar el modelo Shop en la base de datos
$shop->save();
// Mail::to($user->email)->send(new VerificationEmail($user));
Mail::to($user->email)->send(new VerificationEmail($user));
// // Intentar iniciar sesión automáticamente
// if (Auth::attempt($request->only('email', 'password'))) {
// if (Auth::user()->email_verified_at) {
// // La cuenta está verificada, redirige a la página deseada
// return redirect()->route('shop.view.signup.complete');
// } else {
// // La cuenta no está verificada, redirige a la página de verificación de correo electrónico
// return redirect()->route('shop.view.email.verification');
// }
// }
// Intentar iniciar sesión automáticamente
if (Auth::attempt($request->only('email', 'password'))) {
if (Auth::user()->email_verified_at) {
// La cuenta está verificada, redirige a la página deseada
return redirect()->route('seller.dashboard');
} else {
// La cuenta no está verificada, redirige a la página de verificación de correo electrónico
return redirect()->route('shop.view.email.verification');
}
}
}
/**
@@ -137,41 +192,41 @@ class TypeBusinessController extends Controller
//
}
public function business_complete_index()
{
$user = auth()->user();
// public function business_complete_index()
// {
// $user = auth()->user();
return view('frontend.registro-comercio.views.business.business_complete', compact('user'));
}
// return view('frontend.registro-comercio.views.business.business_complete', compact('user'));
// }
public function business_complete_store(Request $request, Shop $shop)
{
// Validación de los campos
$validator = Validator::make($request->all(), [
'name' => ['required'],
'address' => ['required'],
]);
// public function business_complete_store(Request $request, Shop $shop)
// {
// // Validación de los campos
// $validator = Validator::make($request->all(), [
// 'name' => ['required'],
// 'address' => ['required'],
// ]);
// Si la validación falla, puedes redirigir de vuelta con los errores
if ($validator->fails()) {
return redirect()->back()->withErrors($validator)->withInput();
}
// // Si la validación falla, puedes redirigir de vuelta con los errores
// if ($validator->fails()) {
// return redirect()->back()->withErrors($validator)->withInput();
// }
// Guardar los campos en el modelo Shop
$shop->user_id = $request->user()->id;
$shop->name = $request->name;
$shop->address = $request->address;
// Aquí puedes guardar otros campos si los tienes
// // Guardar los campos en el modelo Shop
// $shop->user_id = $request->user()->id;
// $shop->name = $request->name;
// $shop->address = $request->address;
// // Aquí puedes guardar otros campos si los tienes
// Guardar el modelo Shop en la base de datos
$shop->save();
// // Guardar el modelo Shop en la base de datos
// $shop->save();
// Marcar el campo "shop_verified_at" como verificado en el modelo User
$request->user()->shop_verified_at = now(); // Puedes usar la función "now()" para establecer la fecha y hora actual
// // Marcar el campo "shop_verified_at" como verificado en el modelo User
// $request->user()->shop_verified_at = now(); // Puedes usar la función "now()" para establecer la fecha y hora actual
// Guardar el modelo User en la base de datos
$request->user()->save();
// // Guardar el modelo User en la base de datos
// $request->user()->save();
return redirect()->route('seller.dashboard');
}
// return redirect()->route('seller.dashboard');
// }
}

View File

@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Mail\VerificationEmail;
use App\Models\Buyer;
use App\Models\User;
use Auth;
use \ReCaptcha\ReCaptcha;
@@ -23,6 +24,8 @@ class TypeBuyerController extends Controller
*/
public function index()
{
return view('frontend.registro-comercio.views.buyers.index');
}
@@ -42,12 +45,16 @@ class TypeBuyerController extends Controller
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request, User $user)
public function store(Request $request, User $user, Buyer $buyer)
{
// Validación de los campos de registro
$validator = Validator::make($request->all(), [
'name_user' => ['required'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:'.User::class],
'password' => ['required', 'confirmed', Password::defaults()],
'address' => ['required'],
'terms' => ['required'],
'g-recaptcha-response' => ['required', function ($attribute, $value, $fail) {
$recaptcha = new Recaptcha(env('RECAPTCHA_SECRET_KEY'));
$recaptcha->verify($value);
@@ -62,11 +69,23 @@ class TypeBuyerController extends Controller
$confirmation_code = Str::random(25);
$user = new User;
$user->name = $request->input('name_user');
$user->email = $request->input('email');
$user->password = Hash::make($request->input('password'));
$user->user_type = 'customer';
$user->confirmation_code = $confirmation_code;
$user->save();
// Guardar los campos en el modelo Shop
$buyer->user_id = $user->id;
$buyer->address = $request->address;
$buyer->delivery_pickup_latitude = $request->latitude;
$buyer->delivery_pickup_longitude = $request->longitude;
// Aquí puedes guardar otros campos si los tienes
// Guardar el modelo Shop en la base de datos
$buyer->save();
Mail::to($user->email)->send(new VerificationEmail($user));

View File

@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Mail\VerificationEmail;
use App\Models\CategoryTranslation;
use App\Models\Shop;
use App\Models\User;
use App\Models\Workshop;
@@ -24,7 +25,10 @@ class TypeWorkshopController extends Controller
*/
public function index()
{
return view('frontend.registro-comercio.views.workshops.index');
$categories = CategoryTranslation::all();
return view('frontend.registro-comercio.views.workshops.index', compact('categories'));
}
/**
@@ -43,16 +47,42 @@ class TypeWorkshopController extends Controller
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request, User $user)
public function store(Request $request, User $user, Workshop $workshop)
{
// Validación de los campos de registro
$validator = Validator::make($request->all(), [
'email' => ['required', 'string', 'email', 'max:255', 'unique:'.User::class],
$validator = Validator::make($request->all(), [
'name_user' => ['required'],
'name' => ['required'],
'address' => ['required'],
'categories_id' => ['required'],
'email' => [
'required',
'string',
'email',
'max:255',
'unique:'.User::class,
//VALIDA EL TIPO DE extencion del dominio permitido
'regex:/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+.(com|do|net|com.do)$/',
//valida si el correo existe, a traves de los dns
//La función filter_var($value, FILTER_VALIDATE_EMAIL) verifica si la cadena de correo electrónico es una dirección de correo electrónico válida según el filtro FILTER_VALIDATE_EMAIL de PHP.
//La función checkdnsrr($domain, 'MX') verifica si el dominio del correo electrónico tiene registros MX en el sistema de nombres de dominio (DNS). Esto se hace utilizando la función checkdnsrr de PHP con el tipo de registro 'MX'.
//Los tipos de registro DNS válidos son: 'A', 'MX', 'NS', 'SOA', 'PTR', 'CNAME', 'AAAA', 'A6', 'SRV', 'NAPTR', 'TXT', 'ANY'.
function ($attribute, $value, $fail) {
$domain = explode('@', $value)[1];
if (!filter_var($value, FILTER_VALIDATE_EMAIL) || !checkdnsrr($domain, 'MX')) {
$fail('El correo electrónico no existe.');
}
},
],
'password' => ['required', 'confirmed', Password::defaults()],
'g-recaptcha-response' => ['required', function ($attribute, $value, $fail) {
$recaptcha = new Recaptcha(env('RECAPTCHA_SECRET_KEY'));
$recaptcha->verify($value);
}],
'terms' => ['required'],
'g-recaptcha-response' => [
'required',
function ($attribute, $value, $fail) {
$recaptcha = new Recaptcha(env('RECAPTCHA_SECRET_KEY'));
$recaptcha->verify($value);
},
],
]);
if ($validator->fails()) {
@@ -60,14 +90,28 @@ class TypeWorkshopController extends Controller
return redirect()->back()->withErrors($validator)->withInput();
}
//crear el token de verificacion de correo
$confirmation_code = Str::random(25);
$user = new User();
$user->name = $request->input('name_user');
$user->email = $request->input('email');
$user->password = Hash::make($request->input('password'));
$user->user_type = 'repair';
$user->confirmation_code = $confirmation_code;
$user->category_translation_id = $request->input('categories_id');
$user->save();
// Guardar los campos en el modelo Shop
$workshop->user_id = $user->id;
$workshop->name = $request->name;
$workshop->address = $request->address;
$workshop->delivery_pickup_latitude = $request->latitude;
$workshop->delivery_pickup_longitude = $request->longitude;
// Aquí puedes guardar otros campos si los tienes
// Guardar el modelo Shop en la base de datos
$workshop->save();
Mail::to($user->email)->send(new VerificationEmail($user));
@@ -76,12 +120,72 @@ class TypeWorkshopController extends Controller
if (Auth::attempt($request->only('email', 'password'))) {
if (Auth::user()->email_verified_at) {
// La cuenta está verificada, redirige a la página deseada
return redirect()->route('shop.view.signup.complete');
return redirect()->route('workshop.dashboard');
} else {
// La cuenta no está verificada, redirige a la página de verificación de correo electrónico
return redirect()->route('shop.view.email.verification');
}
}
// // Validación de los campos de registro
// $validator = Validator::make($request->all(), [
// 'email' => ['required', 'string', 'email', 'max:255', 'unique:'.User::class],
// 'password' => ['required', 'confirmed', Password::defaults()],
// 'g-recaptcha-response' => ['required', function ($attribute, $value, $fail) {
// $recaptcha = new Recaptcha(env('RECAPTCHA_SECRET_KEY'));
// $recaptcha->verify($value);
// }],
// ]);
// if ($validator->fails()) {
// // Si la validación falla, puedes redirigir o devolver una respuesta con los errores
// return redirect()->back()->withErrors($validator)->withInput();
// }
// $confirmation_code = Str::random(25);
// $user = new User();
// $user->email = $request->input('email');
// $user->password = Hash::make($request->input('password'));
// $user->user_type = 'repair';
// $user->confirmation_code = $confirmation_code;
// $user->save();
// Mail::to($user->email)->send(new VerificationEmail($user));
// // Intentar iniciar sesión automáticamente
// if (Auth::attempt($request->only('email', 'password'))) {
// if (Auth::user()->email_verified_at) {
// // La cuenta está verificada, redirige a la página deseada
// return redirect()->route('shop.view.signup.complete');
// } else {
// // La cuenta no está verificada, redirige a la página de verificación de correo electrónico
// return redirect()->route('shop.view.email.verification');
// }
// }
}
/**
@@ -129,41 +233,41 @@ class TypeWorkshopController extends Controller
//
}
public function workshop_complete_index()
{
$user = auth()->user();
// public function workshop_complete_index()
// {
// $user = auth()->user();
return view('frontend.registro-comercio.views.workshops.workshop_complete', compact('user'));
}
// return view('frontend.registro-comercio.views.workshops.workshop_complete', compact('user'));
// }
public function workshop_complete_store(Request $request, Workshop $workshop)
{
// Validación de los campos
$validator = Validator::make($request->all(), [
'name' => ['required'],
'address' => ['required'],
]);
// public function workshop_complete_store(Request $request, Workshop $workshop)
// {
// // Validación de los campos
// $validator = Validator::make($request->all(), [
// 'name' => ['required'],
// 'address' => ['required'],
// ]);
// Si la validación falla, puedes redirigir de vuelta con los errores
if ($validator->fails()) {
return redirect()->back()->withErrors($validator)->withInput();
}
// // Si la validación falla, puedes redirigir de vuelta con los errores
// if ($validator->fails()) {
// return redirect()->back()->withErrors($validator)->withInput();
// }
// Guardar los campos en el modelo Workshop
$workshop->name = $request->name;
$workshop->address = $request->address;
// Aquí puedes guardar otros campos si los tienes
// // Guardar los campos en el modelo Workshop
// $workshop->name = $request->name;
// $workshop->address = $request->address;
// // Aquí puedes guardar otros campos si los tienes
// Guardar el modelo Workshop en la base de datos
$workshop->save();
// // Guardar el modelo Workshop en la base de datos
// $workshop->save();
// Asignar el ID del taller al campo "workshop_id" en el modelo User
// // Asignar el ID del taller al campo "workshop_id" en el modelo User
// Marcar el campo "shop_verified_at" como verificado en el modelo User
$request->user()->shop_verified_at = now(); // Puedes usar la función "now()" para establecer la fecha y hora actual
$request->user()->workshop_id = $workshop->id;
$request->user()->save();
// // Marcar el campo "shop_verified_at" como verificado en el modelo User
// $request->user()->shop_verified_at = now(); // Puedes usar la función "now()" para establecer la fecha y hora actual
// $request->user()->workshop_id = $workshop->id;
// $request->user()->save();
return redirect()->route('workshop.dashboard');
}
// return redirect()->route('workshop.dashboard');
// }
}

View File

@@ -86,22 +86,67 @@ class UpdateController extends Controller
public function step2()
{
if (get_setting('current_version') == '7.5.0') {
$sql_path = base_path('sqlupdates/v760.sql');
if (get_setting('current_version') == '7.8.0') {
$sql_path = base_path('sqlupdates/v790.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
if (get_setting('current_version') == '7.4.0') {
if (get_setting('current_version') == '7.7.0') {
$sql_path = base_path('sqlupdates/v780.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v790.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
elseif (get_setting('current_version') == '7.6.0') {
$sql_path = base_path('sqlupdates/v770.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v780.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v790.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
elseif (get_setting('current_version') == '7.5.0') {
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v770.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v780.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v790.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
elseif (get_setting('current_version') == '7.4.0') {
$sql_path = base_path('sqlupdates/v750.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v770.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v780.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v790.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
if (get_setting('current_version') == '7.3.0') {
elseif (get_setting('current_version') == '7.3.0') {
$sql_path = base_path('sqlupdates/v740.sql');
DB::unprepared(file_get_contents($sql_path));
@@ -111,9 +156,18 @@ class UpdateController extends Controller
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v770.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v780.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v790.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
if (get_setting('current_version') == '7.2.0') {
elseif (get_setting('current_version') == '7.2.0') {
$sql_path = base_path('sqlupdates/v730.sql');
DB::unprepared(file_get_contents($sql_path));
@@ -126,9 +180,18 @@ class UpdateController extends Controller
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v770.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v780.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v790.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
if (get_setting('current_version') == '7.1.0') {
elseif (get_setting('current_version') == '7.1.0') {
$sql_path = base_path('sqlupdates/v720.sql');
DB::unprepared(file_get_contents($sql_path));
@@ -144,9 +207,18 @@ class UpdateController extends Controller
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v770.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v780.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v790.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
if (get_setting('current_version') == '7.0.0') {
elseif (get_setting('current_version') == '7.0.0') {
$sql_path = base_path('sqlupdates/v710.sql');
DB::unprepared(file_get_contents($sql_path));
@@ -165,6 +237,15 @@ class UpdateController extends Controller
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v770.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v780.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v790.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
elseif (get_setting('current_version') == '6.5.0') {
@@ -189,593 +270,18 @@ class UpdateController extends Controller
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
elseif (get_setting('current_version') == '6.4.0') {
$sql_path = base_path('sqlupdates/v650.sql');
$sql_path = base_path('sqlupdates/v770.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v700.sql');
$sql_path = base_path('sqlupdates/v780.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v710.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v720.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v730.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v740.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v750.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
elseif (get_setting('current_version') == '6.3.3') {
$sql_path = base_path('sqlupdates/v640.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v650.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v700.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v710.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v720.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v730.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v740.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v750.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
elseif (get_setting('current_version') == '6.3.2') {
$sql_path = base_path('sqlupdates/v633.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v640.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v650.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v700.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v710.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v720.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v730.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v740.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v750.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
elseif (get_setting('current_version') == '6.3.1') {
$sql_path = base_path('sqlupdates/v632.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v633.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v640.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v650.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v700.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v710.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v720.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v730.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v740.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v750.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
elseif (get_setting('current_version') == '6.3.0') {
$sql_path = base_path('sqlupdates/v631.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v632.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v633.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v640.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v650.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v700.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v710.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v720.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v730.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v740.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v750.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
elseif (get_setting('current_version') == '6.2.0') {
$sql_path = base_path('sqlupdates/v630.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v631.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v632.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v633.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v640.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v650.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v700.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v710.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v720.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v730.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v740.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v750.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
elseif (get_setting('current_version') == '6.1.5') {
$sql_path = base_path('sqlupdates/v620.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v630.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v631.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v632.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v633.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v640.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v650.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v700.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v710.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v720.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v730.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v740.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v750.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
elseif (get_setting('current_version') == '6.1.4') {
$sql_path = base_path('sqlupdates/v615.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v620.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v630.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v631.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v632.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v633.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v640.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v650.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v700.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v710.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v720.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v730.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v740.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v750.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
elseif (get_setting('current_version') == '6.1.3') {
$sql_path = base_path('sqlupdates/v614.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v615.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v620.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v630.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v631.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v632.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v633.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v640.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v650.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v700.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v710.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v720.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v730.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v740.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v750.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
elseif (get_setting('current_version') == '6.1.2') {
$sql_path = base_path('sqlupdates/v613.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v614.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v615.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v620.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v630.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v631.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v632.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v633.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v640.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v650.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v700.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v710.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v720.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v730.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v740.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v750.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
elseif (get_setting('current_version') == '6.1.1') {
$sql_path = base_path('sqlupdates/v612.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v613.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v614.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v615.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v620.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v630.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v631.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v632.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v633.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v640.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v650.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v700.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v710.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v720.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v730.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v740.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v750.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
elseif (get_setting('current_version') == '6.1') {
$sql_path = base_path('sqlupdates/v611.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v612.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v613.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v614.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v615.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v620.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v630.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v631.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v632.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v633.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v640.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v650.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v700.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v710.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v720.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v730.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v740.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v750.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v760.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
elseif (get_setting('current_version') == '6.0') {
$sql_path = base_path('sqlupdates/v61.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v611.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v612.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v613.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v614.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v615.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v620.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v630.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v631.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v632.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v633.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v640.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v650.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v700.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v710.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v720.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v730.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v740.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v750.sql');
DB::unprepared(file_get_contents($sql_path));
$sql_path = base_path('sqlupdates/v760.sql');
$sql_path = base_path('sqlupdates/v790.sql');
DB::unprepared(file_get_contents($sql_path));
return redirect()->route('update.step3');
}
else {
Artisan::call('view:clear');
Artisan::call('cache:clear');
@@ -792,11 +298,11 @@ class UpdateController extends Controller
Artisan::call('view:clear');
Artisan::call('cache:clear');
$this->setAdmnRole();
$this->convertSellerIntoShop();
$this->convertSellerIntoUser();
$this->convertSellerPackageIntoShop();
$this->convertTrasnalations();
// $this->setAdmnRole();
// $this->convertSellerIntoShop();
// $this->convertSellerIntoUser();
// $this->convertSellerPackageIntoShop();
// $this->convertTrasnalations();
// $this->convertColorsName();
$previousRouteServiceProvier = base_path('app/Providers/RouteServiceProvider.php');

View File

@@ -27,9 +27,6 @@ class WalletController extends Controller
$request->session()->put('payment_type', 'wallet_payment');
$request->session()->put('payment_data', $data);
$request->session()->put('payment_type', 'wallet_payment');
$request->session()->put('payment_data', $data);
$decorator = __NAMESPACE__ . '\\Payment\\' . str_replace(' ', '', ucwords(str_replace('_', ' ', $request->payment_option))) . "Controller";
if (class_exists($decorator)) {
return (new $decorator)->pay($request);