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

@@ -1,8 +1,8 @@
APP_NAME="La Pieza.DO"
APP_ENV=local
APP_KEY=base64:doBaoFE9npLSpSKbSJYDxRi9GTgV6eZyCX5eoop+hXI=
APP_DEBUG=true
APP_URL=http://localhost
APP_DEBUG=false
APP_URL="https://devs.lapieza.net"
APP_TIMEZONE="America/Halifax"
DEMO_MODE="Off"
@@ -10,11 +10,11 @@ DEMO_MODE="Off"
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=lapiezado_lapiezado
DB_USERNAME=root
DB_PASSWORD=
DB_HOST="localhost"
DB_PORT="3306"
DB_DATABASE="lapiezado_lapiezado"
DB_USERNAME="lapiezado_lapiezado"
DB_PASSWORD="@LaPieza2023-24!#"
BROADCAST_DRIVER=log
CACHE_DRIVER="file"
@@ -63,11 +63,11 @@ PAYSTACK_SECRET_KEY=""
VOGUE_MERCHANT_ID="DEMO"
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""
GOOGLE_CLIENT_ID="724795873332-h4dnpj7l5t98rtkdjdokcbs34eu4hc9t.apps.googleusercontent.com"
GOOGLE_CLIENT_SECRET="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"
FACEBOOK_CLIENT_ID=""
FACEBOOK_CLIENT_SECRET=""
FACEBOOK_CLIENT_ID="641344891425720"
FACEBOOK_CLIENT_SECRET="ec9df2420c4fc7a5f1a66193027f1ae1"
TRACKING_ID=""
@@ -153,6 +153,7 @@ BKASH_CHECKOUT_PASSWORD="@12345"
MAILGUN_DOMAIN=""
MAILGUN_SECRET=""
RECAPTCHA_SITE_KEY=6LeLn7MnAAAAAEG9wKdhz_h-xys05ZPohc4aPUki
RECAPTCHA_SECRET_KEY=6LeLn7MnAAAAAOg5erYJkp8dWxIIRHMbmk9fDdLS
RECAPTCHA_SITE_KEY=6Le0OJsnAAAAALJsc4xJaNot1HfSmHpYgJYDzTYT
RECAPTCHA_SECRET_KEY=6Le0OJsnAAAAAIVMI3KwkxeLsrhI8GF7BjRX9S
GOOGLE_MAPS_API_KEY=AIzaSyClSVgBcIeXFcWA0Rt-6z6OWoJHrJPl-tI

View File

@@ -3,3 +3,4 @@
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
*.blade.php filter=lfs diff=lfs merge=lfs -text

16
desarrollo/.gitignore vendored
View File

@@ -1 +1,17 @@
/public/storage
/storage/*.key
/vendor
.env
/public/uploads
/source_code
updates.zip
uploads.zip
shop.sql
/sqlupdates
/diseno
/logs
/refs
/temp
/info
/hooks
/objects

View File

@@ -1,6 +0,0 @@
{
"githubPullRequests.ignoredPullRequestBranches": [
"master"
],
"git.ignoreLimitWarning": true
}

View File

@@ -0,0 +1 @@
corrigiendo errores en admin

3
desarrollo/FETCH_HEAD Normal file
View File

@@ -0,0 +1,3 @@
f8256bd57d1ed333573ef882ced037c984592ef0 branch 'alejandro' of https://github.com/lapieza-dev/main
fd3f3400a2919f3c89ad141f26b1771fe05519fd not-for-merge branch 'kquiroz' of https://github.com/lapieza-dev/main
5ef9b4848a57256d3ed507b6868aacb46b840a6b not-for-merge branch 'master' of https://github.com/lapieza-dev/main

1
desarrollo/HEAD Normal file
View File

@@ -0,0 +1 @@
ref: refs/heads/alejandro

1
desarrollo/ORIG_HEAD Normal file
View File

@@ -0,0 +1 @@
ea124233b1b915da86cde30e3cc8453e33d69fb6

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);

View File

@@ -1,27 +1,50 @@
<?php
use Carbon\Carbon;
use App\Models\Tax;
use App\Models\Cart;
use App\Models\City;
use App\Models\Shop;
use App\Models\User;
use App\Models\Addon;
use App\Models\Brand;
use App\Models\Color;
use App\Models\Order;
use App\Models\Coupon;
use App\Models\Seller;
use App\Models\Upload;
use App\Models\Wallet;
use App\Models\Address;
use App\Models\Carrier;
use App\Models\Country;
use App\Models\Product;
use App\Models\Category;
use App\Models\Currency;
use App\Models\Language;
use App\Models\Wishlist;
use App\Models\Attribute;
use App\Models\ClubPoint;
use App\Models\FlashDeal;
use App\Models\CouponUsage;
use App\Models\DeliveryBoy;
use App\Models\OrderDetail;
use App\Models\PickupPoint;
use App\Models\Translation;
use App\Models\BlogCategory;
use App\Models\Conversation;
use App\Models\FollowSeller;
use App\Models\ProductStock;
use App\Models\CombinedOrder;
use App\Models\SellerPackage;
use App\Models\AffiliateConfig;
use App\Models\AffiliateOption;
use App\Models\BusinessSetting;
use App\Models\CustomerPackage;
use App\Models\CustomerProduct;
use App\Utility\SendSMSUtility;
use App\Utility\CategoryUtility;
use App\Models\AuctionProductBid;
use App\Models\ManualPaymentMethod;
use App\Models\SellerPackagePayment;
use App\Utility\NotificationUtility;
use App\Http\Resources\V2\CarrierCollection;
@@ -29,11 +52,6 @@ use App\Http\Controllers\AffiliateController;
use App\Http\Controllers\ClubPointController;
use App\Http\Controllers\CommissionController;
use AizPackages\ColorCodeConverter\Services\ColorCodeConverter;
use App\Models\Brand;
use App\Models\Category;
use App\Models\CustomerProduct;
use App\Models\FlashDeal;
use App\Models\Language;
//sensSMS function for OTP
if (!function_exists('sendSMS')) {
@@ -91,6 +109,15 @@ if (!function_exists('convert_to_kes')) {
}
}
// get all active countries
if (!function_exists('get_active_countries')) {
function get_active_countries()
{
$country_query = Country::query();
return $country_query->isEnabled()->get();
}
}
//filter products based on vendor activation system
if (!function_exists('filter_products')) {
function filter_products($products)
@@ -214,7 +241,6 @@ if (!function_exists('format_price')) {
}
}
//formats price to home default price with convertion
if (!function_exists('single_price')) {
function single_price($price)
@@ -1145,11 +1171,11 @@ if (!function_exists('my_asset')) {
*/
function my_asset($path, $secure = null)
{
if (env('FILESYSTEM_DRIVER') == 's3') {
return Storage::disk('s3')->url($path);
} else {
return app('url')->asset('public/' . $path, $secure);
}
if (env('FILESYSTEM_DRIVER') != 'local') {
return Storage::disk(env('FILESYSTEM_DRIVER'))->url($path);
}
return app('url')->asset('public/' . $path, $secure);
}
}
@@ -1189,11 +1215,11 @@ if (!function_exists('getBaseURL')) {
if (!function_exists('getFileBaseURL')) {
function getFileBaseURL()
{
if (env('FILESYSTEM_DRIVER') == 's3') {
return env('AWS_URL') . '/';
} else {
return getBaseURL() . 'public/';
if (env('FILESYSTEM_DRIVER') != 'local') {
return env(Str::upper(env('FILESYSTEM_DRIVER')).'_URL') . '/';
}
return getBaseURL() . 'public/';
}
}
@@ -1328,6 +1354,20 @@ if (!function_exists('checkout_done')) {
}
}
// get user total ordered products
if (!function_exists('get_user_total_ordered_products')) {
function get_user_total_ordered_products()
{
$orders_query = Order::query();
$orders = $orders_query->where('user_id', Auth::user()->id)->get();
$total = 0;
foreach ($orders as $order) {
$total += count($order->orderDetails);
}
return $total;
}
}
//for api
if (!function_exists('wallet_payment_done')) {
function wallet_payment_done($user_id, $amount, $payment_method, $payment_details)
@@ -1475,11 +1515,20 @@ if (!function_exists('get_url_params')) {
}
}
// get Admin
if (!function_exists('get_admin')) {
function get_admin()
{
$admin_query = User::query();
return $admin_query->where('user_type', 'admin')->first();
}
}
if (!function_exists('get_featured_flash_deal')) {
function get_featured_flash_deal()
{
$featured_flash_deal_query = FlashDeal::query();
$featured_flash_deal = $featured_flash_deal_query->where('status', 1)->where('featured', 1)
$featured_flash_deal = $featured_flash_deal_query->isActiveAndFeatured()
->where('start_date', '<=', strtotime(date('Y-m-d H:i:s')))
->where('end_date', '>=', strtotime(date('Y-m-d H:i:s')))
->first();
@@ -1488,6 +1537,26 @@ if (!function_exists('get_featured_flash_deal')) {
}
}
if (!function_exists('get_active_flash_deals')) {
function get_active_flash_deals()
{
$activated_flash_deal_query = FlashDeal::query();
$activated_flash_deal_query = $activated_flash_deal_query->where("status", 1);
return $activated_flash_deal_query->get();
}
}
if (!function_exists('get_active_taxes')) {
function get_active_taxes()
{
$activated_tax_query = Tax::query();
$activated_tax_query = $activated_tax_query->where("tax_status", 1);
return $activated_tax_query->get();
}
}
if (!function_exists('get_system_language')) {
function get_system_language()
{
@@ -1514,6 +1583,15 @@ if (!function_exists('get_all_active_language')) {
}
}
// get Session langauge
if (!function_exists('get_session_language')) {
function get_session_language()
{
$language_query = Language::query();
return $language_query->where('code', Session::get('locale', Config::get('app.locale')))->first();
}
}
if (!function_exists('get_system_currency')) {
function get_system_currency()
{
@@ -1532,34 +1610,131 @@ if (!function_exists('get_system_currency')) {
if (!function_exists('get_all_active_currency')) {
function get_all_active_currency()
{
$language_query = Currency::query();
$language_query->where('status', 1);
$currency_query = Currency::query();
$currency_query->where('status', 1);
return $language_query->get();
return $currency_query->get();
}
}
if (!function_exists('get_single_product')) {
function get_single_product($product_id)
{
$product_query = Product::query();
$product_query = Product::query()->with('thumbnail');
return $product_query->find($product_id);
}
}
if (!function_exists('get_single_brand')) {
function get_single_brand($brand_id)
// get multiple Products
if (!function_exists('get_multiple_products')) {
function get_multiple_products($product_ids)
{
$brand_query = Brand::query();
return $brand_query->find($brand_id);
$products_query = Product::query();
return $products_query->whereIn('id', $product_ids)->get();
}
}
if (!function_exists('get_single_category')) {
function get_single_category($category_id)
// get count of products
if (!function_exists('get_products_count')) {
function get_products_count($user_id = null)
{
$category_query = Category::query();
return $category_query->find($category_id);
$products_query = Product::query();
if($user_id){
$products_query = $products_query->where('user_id', $user_id);
}
return $products_query->isApprovedPublished()->count();
}
}
// get minimum unit price of products
if (!function_exists('get_product_min_unit_price')) {
function get_product_min_unit_price($user_id = null)
{
$product_query = Product::query();
if($user_id){
$product_query = $product_query->where('user_id', $user_id);
}
return $product_query->isApprovedPublished()->min('unit_price');
}
}
// get maximum unit price of products
if (!function_exists('get_product_max_unit_price')) {
function get_product_max_unit_price($user_id = null)
{
$product_query = Product::query();
if($user_id){
$product_query = $product_query->where('user_id', $user_id);
}
return $product_query->isApprovedPublished()->max('unit_price');
}
}
if (!function_exists('get_featured_products')) {
function get_featured_products()
{
return Cache::remember('featured_products', 3600, function () {
$product_query = Product::query();
return filter_products($product_query->where('featured', '1'))->latest()->limit(12)->get();
});
}
}
if (!function_exists('get_best_selling_products')) {
function get_best_selling_products($limit, $user_id=null)
{
$product_query = Product::query();
if($user_id){
$product_query = $product_query->where('user_id', $user_id);
}
return filter_products($product_query->orderBy('num_of_sale', 'desc'))->limit($limit)->get();
}
}
// Get Seller Products
if (!function_exists('get_all_sellers')) {
function get_all_sellers()
{
$seller_query = Seller::query();
return $seller_query->get();
}
}
// Get Seller Products
if (!function_exists('get_seller_products')) {
function get_seller_products($user_id)
{
$product_query = Product::query();
return $product_query->where('user_id', $user_id)->isApprovedPublished()->orderBy('created_at', 'desc')->limit(15)->get();
}
}
// Get Seller Best Selling Products
if (!function_exists('get_shop_best_selling_products')) {
function get_shop_best_selling_products($user_id)
{
$product_query = Product::query();
return $product_query->where('user_id', $user_id)->isApprovedPublished()->orderBy('num_of_sale', 'desc')->paginate(24);
}
}
// Get all auction Products
if (!function_exists('get_all_auction_products')) {
function get_auction_products($limit=null, $paginate=null)
{
$product_query = Product::query();
$products = $product_query->latest()->where('published', 1)->where('auction_product', 1);
if (get_setting('seller_auction_product') == 0) {
$products = $products->where('added_by', 'admin');
}
$products = $products->where('auction_start_date', '<=', strtotime("now"))->where('auction_end_date', '>=', strtotime("now"));
if($limit){
$products = $products->limit($limit);
}elseif($paginate){
return $products->paginate($paginate);
}
return $products->get();
}
}
@@ -1597,6 +1772,119 @@ if (!function_exists('get_home_page_classified_products')) {
}
}
// Get related product
if (!function_exists('get_related_products')) {
function get_related_products($product)
{
$product_query = Product::query();
return filter_products($product_query->where('id', '!=', $product->id)->where('category_id', $product->category_id))->limit(10)->get();
}
}
// Get all brands
if (!function_exists('get_all_brands')) {
function get_all_brands()
{
$brand_query = Brand::query();
return $brand_query->get();
}
}
// Get single brands
if (!function_exists('get_single_brand')) {
function get_single_brand($brand_id)
{
$brand_query = Brand::query();
return $brand_query->find($brand_id);
}
}
// Get Brands by products
if (!function_exists('get_brands_by_products')) {
function get_brands_by_products($usrt_id)
{
$product_query = Product::query();
$brand_ids = $product_query->where('user_id', $usrt_id)->isApprovedPublished()->whereNotNull('brand_id')->pluck('brand_id')->toArray();
$brand_query = Brand::query();
return $brand_query->whereIn('id', $brand_ids)->get();
}
}
// Get single category
if (!function_exists('get_single_category')) {
function get_single_category($category_id)
{
$category_query = Category::query()->with('coverImage');
return $category_query->find($category_id);
}
}
// Get categories by level zero
if (!function_exists('get_level_zero_categories')) {
function get_level_zero_categories()
{
$categories_query = Category::query();
return $categories_query->where('level', 0)->orderBy('order_level', 'desc')->get();
}
}
// Get categories by products
if (!function_exists('get_categories_by_products')) {
function get_categories_by_products($user_id)
{
$product_query = Product::query();
$category_ids = $product_query->where('user_id', $user_id)->isApprovedPublished()->pluck('category_id')->toArray();
$category_query = Category::query();
return $category_query->whereIn('id', $category_ids)->get();
}
}
// Get single Color name
if (!function_exists('get_single_color_name')) {
function get_single_color_name($color)
{
$color_query = Color::query();
return $color_query->where('code', $color)->first()->name;
}
}
// Get single Attribute
if (!function_exists('get_single_attribute_name')) {
function get_single_attribute_name($attribute)
{
$attribute_query = Attribute::query();
return $attribute_query->find($attribute)->getTranslation('name');
}
}
// Get user cart
if (!function_exists('get_user_cart')) {
function get_user_cart()
{
$cart = null;
if (auth()->user() != null) {
$cart = Cart::where('user_id', Auth::user()->id)->get();
} else {
$temp_user_id = Session()->get('temp_user_id');
if ($temp_user_id) {
$cart = Cart::where('temp_user_id', $temp_user_id)->get();
}
}
return $cart;
}
}
// Get user Wishlist
if (!function_exists('get_user_wishlist')) {
function get_user_wishlist()
{
$wishlist_query = Wishlist::query();
return $wishlist_query->where('user_id', Auth::user()->id)->get();
}
}
//Get best seller
if (!function_exists('get_best_sellers')) {
function get_best_sellers($limit = '')
@@ -1607,6 +1895,271 @@ if (!function_exists('get_best_sellers')) {
}
}
//Get users followed sellers
if (!function_exists('get_followed_sellers')) {
function get_followed_sellers()
{
$followed_seller_query = FollowSeller::query();
return $followed_seller_query->where('user_id', Auth::user()->id)->pluck('shop_id')->toArray();
}
}
// Get Order Details
if (!function_exists('get_order_details')) {
function get_order_details($order_id)
{
$order_detail_query = OrderDetail::query();
return $order_detail_query->find($order_id);
}
}
// Get Order Details by review
if (!function_exists('get_order_details_by_review')) {
function get_order_details_by_review($review)
{
$order_detail_query = OrderDetail::query();
return $order_detail_query->with(['order' => function ($q) use($review) {
$q->where('user_id', $review->user_id);
}])->where('product_id', $review->product_id)->where('delivery_status', 'delivered')->first();
}
}
// Get user total expenditure
if (!function_exists('get_user_total_expenditure')) {
function get_user_total_expenditure()
{
$user_expenditure_query = Order::query();
return $user_expenditure_query->where('user_id', Auth::user()->id)->where('payment_status', 'paid')->sum('grand_total');
}
}
// Get count by delivery viewed
if (!function_exists('get_count_by_delivery_viewed')) {
function get_count_by_delivery_viewed()
{
$order_query = Order::query();
return $order_query->where('user_id', Auth::user()->id)->where('delivery_viewed', 0)->get()->count();
}
}
// Get delivery boy info
if (!function_exists('get_delivery_boy_info')) {
function get_delivery_boy_info()
{
$delivery_boy_info_query = DeliveryBoy::query();
return $delivery_boy_info_query->where('user_id', Auth::user()->id)->first();
}
}
// Get count by completed delivery
if (!function_exists('get_delivery_boy_total_completed_delivery')) {
function get_delivery_boy_total_completed_delivery()
{
$delivery_boy_delivery_query = Order::query();
return $delivery_boy_delivery_query->where('assign_delivery_boy', Auth::user()->id)
->where('delivery_status', 'delivered')
->count();
}
}
// Get count by pending delivery
if (!function_exists('get_delivery_boy_total_pending_delivery')) {
function get_delivery_boy_total_pending_delivery()
{
$delivery_boy_delivery_query = Order::query();
return $delivery_boy_delivery_query->where('assign_delivery_boy', Auth::user()->id)
->where('delivery_status', '!=', 'delivered')
->where('delivery_status', '!=', 'cancelled')
->where('cancel_request', '0')
->count();
}
}
// Get count by cancelled delivery
if (!function_exists('get_delivery_boy_total_cancelled_delivery')) {
function get_delivery_boy_total_cancelled_delivery()
{
$delivery_boy_delivery_query = Order::query();
return $delivery_boy_delivery_query->where('assign_delivery_boy', Auth::user()->id)
->where('delivery_status', 'cancelled')
->count();
}
}
// Get count by payment status viewed
if (!function_exists('get_order_info')) {
function get_order_info($order_id = null)
{
$order_query = Order::query();
return $order_query->where('id',$order_id)->first();
}
}
// Get count by payment status viewed
if (!function_exists('get_user_order_by_id')) {
function get_user_order_by_id($order_id = null)
{
$order_query = Order::query();
return $order_query->where('id',$order_id)->where('user_id',Auth::user()->id)->first();
}
}
// Get Auction Product Bid Info
if (!function_exists('get_auction_product_bid_info')) {
function get_auction_product_bid_info($bid_id = null)
{
$product_bid_info_query = AuctionProductBid::query();
return $product_bid_info_query->where('id',$bid_id)->first();
}
}
// Get count by payment status viewed
if (!function_exists('get_count_by_payment_status_viewed')) {
function get_count_by_payment_status_viewed()
{
$order_query = Order::query();
return $order_query->where('user_id', Auth::user()->id)->where('payment_status_viewed', 0)->get()->count();
}
}
// Get Uploaded file
if (!function_exists('get_single_uploaded_file')) {
function get_single_uploaded_file($file_id)
{
$file_query = Upload::query();
return $file_query->find($file_id);
}
}
// Get single customer package file
if (!function_exists('get_single_customer_package')) {
function get_single_customer_package($package_id)
{
$customer_package_query = CustomerPackage::query();
return $customer_package_query->find($package_id);
}
}
// Get single Seller package file
if (!function_exists('get_single_seller_package')) {
function get_single_seller_package($package_id)
{
$seller_package_query = SellerPackage::query();
return $seller_package_query->find($package_id);
}
}
// Get user last wallet recharge
if (!function_exists('get_user_last_wallet_recharge')) {
function get_user_last_wallet_recharge()
{
$recharge_query = Wallet::query();
return $recharge_query->where('user_id', Auth::user()->id)->orderBy('id', 'desc')->first();
}
}
// Get user total Club point
if (!function_exists('get_user_total_club_point')) {
function get_user_total_club_point()
{
$club_point_query = ClubPoint::query();
return $club_point_query->where('user_id', Auth::user()->id)->where('convert_status', 0)->sum('points');
}
}
// Get all manual payment methods
if (!function_exists('get_all_manual_payment_methods')) {
function get_all_manual_payment_methods()
{
$manual_payment_methods_query = ManualPaymentMethod::query();
return $manual_payment_methods_query->get();
}
}
// Get all blog category
if (!function_exists('get_all_blog_categories')) {
function get_all_blog_categories()
{
$blog_category_query = BlogCategory::query();
return $blog_category_query->get();
}
}
// Get all Pickup Points
if (!function_exists('get_all_pickup_points')) {
function get_all_pickup_points()
{
$pickup_points_query = PickupPoint::query();
return $pickup_points_query->isActive()->get();
}
}
// get Shop by user id
if (!function_exists('get_shop_by_user_id')) {
function get_shop_by_user_id($user_id)
{
$shop_query = Shop::query();
return $shop_query->where('user_id', $user_id)->first();
}
}
// get Coupons
if (!function_exists('get_coupons')) {
function get_coupons($user_id = null, $paginate = null)
{
$coupon_query = Coupon::query();
$coupon_query = $coupon_query->where('start_date', '<=', strtotime(date('d-m-Y')))->where('end_date', '>=', strtotime(date('d-m-Y')));
if($user_id){
$coupon_query = $coupon_query-> where('user_id', $user_id);
}
if($paginate){
return $coupon_query->paginate($paginate);
}
return $coupon_query->get();
}
}
// get non-viewed Conversations
if (!function_exists('get_non_viewed_conversations')) {
function get_non_viewed_conversations()
{
$Conversation_query = Conversation::query();
return $Conversation_query->where('sender_id', Auth::user()->id)->where('sender_viewed', 0)->get();
}
}
// get affliate option status
if (!function_exists('get_affliate_option_status')) {
function get_affliate_option_status($status = false)
{
if(AffiliateOption::where('type', 'product_sharing')->first()->status ||
AffiliateOption::where('type', 'category_wise_affiliate')->first()->status){
$status = true;
}
return $status;
}
}
// get affliate option purchase status
if (!function_exists('get_affliate_purchase_option_status')) {
function get_affliate_purchase_option_status($status = false)
{
if(AffiliateOption::where('type', 'user_registration_first_purchase')->first()->status){
$status = true;
}
return $status;
}
}
// get affliate config
if (!function_exists('get_Affiliate_onfig_value')) {
function get_Affiliate_onfig_value()
{
return AffiliateConfig::where('type', 'verification_form')->first()->value;
}
}
if (!function_exists('timezones')) {
function timezones()
{

View File

@@ -29,7 +29,6 @@ class Kernel extends HttpKernel
\App\Http\Middleware\TrustProxies::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\CorsMiddleware::class,
];
/**
@@ -89,7 +88,6 @@ class Kernel extends HttpKernel
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,
'prevent-back-history' => \App\Http\Middleware\PreventBackHistory::class,
/* 'cors' => \App\Http\Middleware\CorsMiddleware::class, */
];
/**

View File

@@ -14,15 +14,12 @@ class IsUser
* @param \Closure $next
* @return mixed
*/
//AQUI AGREGO LOS DIFERENTES TIPOS DE USUARIOS
public function handle($request, Closure $next)
{
if (Auth::check() &&
(Auth::user()->user_type == 'customer' ||
Auth::user()->user_type == 'seller' ||
Auth::user()->user_type == 'delivery_boy'||
Auth::user()->user_type == 'repair') ) {
Auth::user()->user_type == 'delivery_boy') ) {
return $next($request);
}

View File

@@ -60,7 +60,7 @@ class ProductRequest extends FormRequest
'unit_price.numeric' => 'Unit price must be numeric',
'discount.required' => 'Discount is required',
'discount.numeric' => 'Discount must be numeric',
'discount.lt:unit_price' => 'Discount can not be gretaer than unit price',
'discount.lt:unit_price' => 'Discount cannot be gretaer than unit price',
'current_stock.required' => 'Current stock is required',
'current_stock.numeric' => 'Current stock must be numeric',
];

View File

@@ -31,7 +31,7 @@ class SellerRegistrationRequest extends FormRequest
$rules['name'] = 'required|string|max:255';
$rules['email'] = 'required|email|unique:users|max:255';
$rules['password' ] = 'required|string|min:6'; /* |confirmed */
$rules['password' ] = 'required|string|min:6|confirmed';
$rules['shop_name' ] = 'required|max:255';
$rules['address'] = 'required';

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Http\Resources\V2\Auction;
use App\Models\Order;
use App\Models\OrderDetail;
use Illuminate\Http\Resources\Json\JsonResource;
class AuctionBidProducts extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
$order = null;
$isBuyable = false;
$my_bided_product = $this->bids->where('user_id', auth()->id())->first();
$highest_bid = $this->bids->max('amount');
$order_detail = OrderDetail::where('product_id', $this->id)->first();
if ($order_detail != null) {
$order = Order::where('id', $order_detail->order_id)->where('user_id', auth()->id())->first();
}
if ($my_bided_product->product->auction_end_date < strtotime("now") && $my_bided_product->amount == $highest_bid && $order == null) {
$action = 'Buy';
$isBuyable = true;
} elseif ($order != null) {
$action = 'Purchased';
} else {
$action = 'N/A';
}
return [
'id' => $this->id,
'name' => $this->name,
'thumbnail_image' => uploaded_asset($this->thumbnail_img),
'my_bid' => single_price($my_bided_product->amount),
'highest_bid' => single_price($highest_bid),
'auction_end_date' => $this->auction_end_date < strtotime("now") ? translate('Ended') : date('d.m.Y H:i:s', $this->auction_end_date),
'action' => $action,
'isBuyable' => $isBuyable,
];
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Http\Resources\V2\Auction;
use Illuminate\Http\Resources\Json\JsonResource;
class AuctionPurchaseHistory extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
$order = \App\Models\Order::find($this->id);
return [
'id' => $order->id,
'code' => $order->code,
'date' => date('d-m-Y', $order->date),
'amount' => single_price($order->grand_total),
'delivery_status' => translate(ucfirst(str_replace('_', ' ', $order->orderDetails->first()->delivery_status))),
'payment_status' => $order->payment_status == 'paid' ? translate('Paid') : translate('Unpaid'),
];
}
}

View File

@@ -28,13 +28,13 @@ class PurchaseHistoryCollection extends ResourceCollection
'payment_status' => $data->payment_status,
'payment_status_string' => ucwords(str_replace('_', ' ', $data->payment_status)),
'delivery_status' => $data->delivery_status,
'delivery_status_string' => $data->delivery_status == 'pending'? "Order Placed" : ucwords(str_replace('_', ' ', $data->delivery_status)),
'grand_total' => format_price($data->grand_total),
'delivery_status_string' => $data->delivery_status == 'pending' ? "Order Placed" : ucwords(str_replace('_', ' ', $data->delivery_status)),
'grand_total' => format_price(convert_price($data->grand_total)),
'plane_grand_total' => $data->grand_total,
'coupon_discount' => format_price($data->coupon_discount),
'shipping_cost' => format_price($data->orderDetails->sum('shipping_cost')),
'subtotal' => format_price($data->orderDetails->sum('price')),
'tax' => format_price($data->orderDetails->sum('tax')),
'coupon_discount' => format_price(convert_price($data->coupon_discount)),
'shipping_cost' => format_price(convert_price($data->orderDetails->sum('shipping_cost'))),
'subtotal' => format_price(convert_price($data->orderDetails->sum('price'))),
'tax' => format_price(convert_price($data->orderDetails->sum('tax'))),
'date' => Carbon::createFromTimestamp($data->date)->format('d-m-Y'),
'cancel_request' => $data->cancel_request == 1,
'manually_payable' => $data->manual_payment && $data->manual_payment_data == null,

View File

@@ -20,12 +20,14 @@ class PurchaseHistoryItemsCollection extends ResourceCollection
$no_of_max_day = get_setting('refund_request_time');
$last_refund_date = $data->created_at->addDays($no_of_max_day);
$today_date = \Carbon\Carbon::now();
if ($data->product != null &&
if (
$data->product != null &&
$data->product->refundable != 0 &&
$data->refund_request == null &&
$today_date <= $last_refund_date &&
$data->payment_status == 'paid' &&
$data->delivery_status == 'delivered') {
$data->delivery_status == 'delivered'
) {
$refund_button = true;
} else if ($data->refund_request != null && $data->refund_request->refund_status == 0) {
$refund_label = "Pending";
@@ -47,10 +49,10 @@ class PurchaseHistoryItemsCollection extends ResourceCollection
'product_id' => $data->product->id,
'product_name' => $data->product->name,
'variation' => $data->variation,
'price' => format_price($data->price),
'tax' => format_price($data->tax),
'shipping_cost' => format_price($data->shipping_cost),
'coupon_discount' => format_price($data->coupon_discount),
'price' => format_price(convert_price($data->price)),
'tax' => format_price(convert_price($data->tax)),
'shipping_cost' => format_price(convert_price($data->shipping_cost)),
'coupon_discount' => format_price(convert_price($data->coupon_discount)),
'quantity' => (int)$data->quantity,
'payment_status' => $data->payment_status,
'payment_status_string' => ucwords(str_replace('_', ' ', $data->payment_status)),

View File

@@ -10,17 +10,17 @@ class PurchaseHistoryMiniCollection extends ResourceCollection
public function toArray($request)
{
return [
'data' => $this->collection->map(function($data) {
'data' => $this->collection->map(function ($data) {
return [
'id' => $data->id,
'code' => $data->code,
'user_id' => intval($data->user_id),
'payment_type' => ucwords(str_replace('_', ' ', $data->payment_type)) ,
'payment_status' => $data->payment_status,
'payment_type' => ucwords(str_replace('_', ' ', $data->payment_type)),
'payment_status' => translate($data->payment_status),
'payment_status_string' => ucwords(str_replace('_', ' ', $data->payment_status)),
'delivery_status' => $data->delivery_status,
'delivery_status_string' => $data->delivery_status == 'pending'? "Order Placed" : ucwords(str_replace('_', ' ', $data->delivery_status)),
'grand_total' => format_price($data->grand_total) ,
'delivery_status' => translate($data->delivery_status),
'delivery_status_string' => $data->delivery_status == 'pending' ? "Order Placed" : ucwords(str_replace('_', ' ', $data->delivery_status)),
'grand_total' => format_price(convert_price($data->grand_total)),
'date' => Carbon::createFromTimestamp($data->date)->format('d-m-Y'),
'links' => [
'details' => ''

View File

@@ -24,6 +24,8 @@ class AuctionProductCollection extends ResourceCollection
'start_date' => date('Y-m-d H:i:s', $data->auction_start_date),
'end_date' => date('Y-m-d H:i:s', $data->auction_end_date),
'total_bids' => (int) $data->bids->count(),
'can_edit' => $data->auction_start_date > strtotime("now"),
'links' => [
'details' => route('products.show', $data->id),
]

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Resources\V2\Seller;
use Illuminate\Http\Resources\Json\ResourceCollection;
class DigitalProductCollection extends ResourceCollection
{
/**
* Transform the resource collection into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
'data' => $this->collection->map(function ($data) {
return [
'id' => $data->id,
'name' => $data->getTranslation('name'),
'thumbnail_img' => uploaded_asset($data->thumbnail_img),
'category' => $data->category->getTranslation('name'),
'price ' => $data->unit_price,
'status' => $data->published == 0 ? false : true,
'featured' => $data->seller_featured == 0 ? false : true
];
})
];
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace App\Http\Resources\V2\Seller;
use App\Http\Resources\V2\UploadedFileCollection;
use App\Models\Upload;
use Illuminate\Http\Resources\Json\JsonResource;
class DigitalProductDetailsResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
"id" => $this->id,
'lang' => $this->lang,
'product_name' => $this->getTranslation('name', $this->lang),
"category_id" => $this->category_id,
"product_file" => new UploadedFileCollection(Upload::whereIn("id",explode(",",$this->file_name))->get()),
"tags" => $this->tags,
"photos" => new UploadedFileCollection(Upload::whereIn("id",explode(",",$this->photos))->get()),
"thumbnail_img" => new UploadedFileCollection(Upload::whereIn("id",explode(",",$this->thumbnail_img))->get()),
"meta_title" => $this->meta_title,
"meta_description" => $this->meta_description,
"meta_img" => new UploadedFileCollection(Upload::where("id",$this->meta_img)->get()),
"slug" => $this->slug,
"unit_price" => $this->unit_price,
"purchase_price" => $this->purchase_price,
"tax" => $this->taxes,
"discount" => $this->discount,
"discount_type" => $this->discount_type,
"discount_start_date" => date("Y-m-d", $this->discount_start_date),
"discount_end_date" => date("Y-m-d", $this->discount_end_date),
"description" => $this->getTranslation('description', $this->lang),
];
}
public function with($request)
{
return [
'result' => true,
'status' => 200
];
}
}

View File

@@ -10,9 +10,9 @@ class WalletCollection extends ResourceCollection
public function toArray($request)
{
return [
'data' => $this->collection->map(function($data) {
'data' => $this->collection->map(function ($data) {
return [
'amount' => format_price ($data->amount) ,
'amount' => single_price(($data->amount)),
'payment_method' => ucwords(str_replace('_', ' ', $data->payment_method)),
'approval_string' => $data->offline_payment ? ($data->approval == 1 ? "Approved" : "Decliend") : "N/A",
'date' => Carbon::createFromTimestamp(strtotime($data->created_at))->format('d-m-Y'),

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Buyer extends Model
{
use HasFactory;
protected $fillable = [
'name',
'address',
'delivery_pickup_latitude',
'delivery_pickup_latitude',
'user_id'
];
}

View File

@@ -19,6 +19,10 @@ class Category extends Model
return $this->hasMany(CategoryTranslation::class);
}
public function coverImage(){
return $this->belongsTo(Upload::class, 'cover_image');
}
public function products(){
return $this->hasMany(Product::class);
}

View File

@@ -6,14 +6,19 @@ use Illuminate\Database\Eloquent\Model;
class Country extends Model
{
/**
* Get the Zone that owns the Country
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function zone()
{
return $this->belongsTo(Zone::class);
}
/**
* Get the Zone that owns the Country
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function zone()
{
return $this->belongsTo(Zone::class);
}
public function scopeIsEnabled($query)
{
return $query->where('status', '1');
}
}

View File

@@ -23,4 +23,10 @@ class FlashDeal extends Model
{
return $this->hasMany(FlashDealProduct::class);
}
public function scopeIsActiveAndFeatured($query)
{
return $query->where('status', '1')
->where('featured', '1');
}
}

View File

@@ -22,4 +22,9 @@ class PickupPoint extends Model
public function staff(){
return $this->belongsTo(Staff::class);
}
public function scopeIsActive($query)
{
return $query->where('pick_up_status', '1');
}
}

View File

@@ -2,15 +2,15 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App;
use Illuminate\Database\Eloquent\Model;
class Product extends Model
{
protected $guarded = ['choice_attributes'];
protected $with = ['product_translations', 'taxes'];
protected $with = ['product_translations', 'taxes', 'thumbnail'];
public function getTranslation($field = '', $lang = false)
{
@@ -74,6 +74,11 @@ class Product extends Model
return $this->hasMany(AuctionProductBid::class);
}
public function thumbnail()
{
return $this->belongsTo(Upload::class, 'thumbnail_img');
}
public function scopePhysical($query)
{
return $query->where('digital', 0);
@@ -83,4 +88,14 @@ class Product extends Model
{
return $query->where('digital', 1);
}
public function carts()
{
return $this->hasMany(Cart::class);
}
public function scopeIsApprovedPublished($query)
{
return $query->where('approved', '1')->where('published', 1);
}
}

View File

@@ -30,6 +30,7 @@ class ProductsExport implements FromCollection, WithMapping, WithHeadings
'purchase_price',
'unit',
'current_stock',
'est_shipping_days',
'meta_title',
'meta_description',
];
@@ -58,6 +59,7 @@ class ProductsExport implements FromCollection, WithMapping, WithHeadings
$product->unit,
// $product->current_stock,
$qty,
$product->est_shipping_days,
$product->meta_title,
$product->meta_description,
];

View File

@@ -56,6 +56,7 @@ class ProductsImport implements ToCollection, WithHeadingRow, WithValidation, To
'unit' => $row['unit'],
'meta_title' => $row['meta_title'],
'meta_description' => $row['meta_description'],
'est_shipping_days' => $row['est_shipping_days'],
'colors' => json_encode(array()),
'choice_options' => json_encode(array()),
'variations' => json_encode(array()),

View File

@@ -9,8 +9,6 @@ class Shop extends Model
protected $with = ['user'];
protected $fillable = ['name', 'address', 'user_id'];
public function user()
{
return $this->belongsTo(User::class);
@@ -22,10 +20,4 @@ class Shop extends Model
public function followers(){
return $this->hasMany(FollowSeller::class);
}
//URL AMIGABLES
public function getRouteKeyName()
{
return 'slug';
}
}

View File

@@ -14,7 +14,10 @@ class User extends Authenticatable implements MustVerifyEmail
{
use Notifiable, HasApiTokens, HasRoles;
public function sendEmailVerificationNotification()
{
$this->notify(new EmailVerificationNotification());
}
/**
* The attributes that are mass assignable.
@@ -22,7 +25,7 @@ class User extends Authenticatable implements MustVerifyEmail
* @var array
*/
protected $fillable = [
'name', 'email', 'password', 'user_type', 'confirmation_code', 'address', 'city', 'postal_code', 'phone', 'country', 'provider_id', 'email_verified_at', 'verification_code'
'name', 'email', 'password', 'address', 'city', 'postal_code', 'phone', 'country', 'provider_id', 'email_verified_at', 'verification_code'
];
/**
@@ -148,10 +151,5 @@ class User extends Authenticatable implements MustVerifyEmail
public function uploads(){
return $this->hasMany(Upload::class);
}
public function workshop()
{
return $this->hasOne(Workshop::class);
}
}

View File

@@ -9,7 +9,7 @@ class Workshop extends Model
{
use HasFactory;
protected $fillable = ['name', 'address'];
protected $fillable = ['name', 'address', 'delivery_pickup_latitude', 'delivery_pickup_longitude', 'user_id'];
public function user()
{

View File

@@ -2,55 +2,18 @@
namespace App\Notifications;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\URL;
use App\Mail\EmailManager;
use Auth;
use App\Models\User;
class EmailVerificationNotification extends Notification
{
use Queueable;
// public $verificationCode;
// public function __construct($verificationCode)
// {
// $this->verificationCode = $verificationCode;
// }
// public function via($notifiable)
// {
// return ['mail'];
// }
// public function toMail($notifiable)
// {
// $verificationCode = $this->verificationCode;
// return (new MailMessage)
// ->subject(translate('Email Verification - ') . env('APP_NAME'))
// ->line('Your verification code is: ' . $verificationCode); // Mostrar el código de verificación en el correo
// }
// public function toArray($notifiable)
// {
// return [
// //
// ];
// }
}
/* class EmailVerificationNotification extends Notification
{
use Queueable;
public function __construct()
{
}
public function via($notifiable)
@@ -70,13 +33,10 @@ class EmailVerificationNotification extends Notification
return (new MailMessage)
->view('emails.verification', ['array' => $array])
->subject(translate('Email Verification - ').env('APP_NAME'));
->subject(translate('Email Verification - ') . env('APP_NAME'));
}
public function toArray($notifiable)
{
return [
//
];
}
} */
}

View File

@@ -0,0 +1,70 @@
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class PayoutNotification extends Notification
{
use Queueable;
protected $user;
protected $amount;
protected $status;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($user, $amount, $status = '')
{
$this->user = $user;
$this->amount = $amount;
$this->status = $status;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['database'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->line('The introduction to the notification.')
->action('Notification Action', url('/'))
->line('Thank you for using our application!');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
'user_id' => $this->user['id'],
'user_type' => $this->user['user_type'],
'name' => $this->user['name'],
'payment_amount' => $this->amount,
'status' => $this->status
];
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class ShopProductNotification extends Notification
{
use Queueable;
protected $type;
protected $product;
protected $status;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($type, $product, $status='pending')
{
$this->type = $type;
$this->product = $product;
$this->status = $status;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['database'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->line('The introduction to the notification.')
->action('Notification Action', url('/'))
->line('Thank you for using our application!');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
'id' => $this->product['id'],
'name' => $this->product['name'],
'status' => $this->status,
'type' => $this->type
];
}
}

View File

@@ -0,0 +1,66 @@
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class ShopVerificationNotification extends Notification
{
use Queueable;
protected $shop;
protected $status;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($shop, $status='submitted')
{
$this->shop = $shop;
$this->status = $status;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['database'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->line('The introduction to the notification.')
->action('Notification Action', url('/'))
->line('Thank you for using our application!');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
'name' => $this->shop['name'],
'id' => $this->shop['id'],
'status'=> $this->status
];
}
}

View File

@@ -3,9 +3,11 @@
namespace App\Services;
use AizPackages\CombinationGenerate\Services\CombinationService;
use App\Models\Cart;
use App\Models\Color;
use App\Models\Product;
use App\Models\User;
use App\Models\Wishlist;
use App\Utility\ProductUtility;
use Combinations;
use Illuminate\Support\Str;
@@ -301,4 +303,19 @@ class ProductService
return $product_new;
}
public function destroy($id)
{
$product = Product::findOrFail($id);
$product->product_translations()->delete();
$product->stocks()->delete();
$product->taxes()->delete();
$product->wishlists()->delete();
$product->carts()->delete();
if(Product::destroy($id)){
return true;
}
return false;
}
}

View File

@@ -0,0 +1,113 @@
<?php
namespace App\Utility;
use App\Models\Cart;
use Cookie;
class CartUtility
{
public static function create_cart_variant($product, $request)
{
$str = null;
if (isset($request['color'])) {
$str = $request['color'];
}
if (isset($product->choice_options) && count(json_decode($product->choice_options)) > 0) {
//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]);
}
}
}
return $str;
}
public static function get_price($product, $product_stock, $quantity)
{
$price = $product_stock->price;
if ($product->auction_product == 1) {
$price = $product->bids->max('amount');
}
if ($product->wholesale_product) {
$wholesalePrice = $product_stock->wholesalePrices->where('min_qty', '<=', $quantity)
->where('max_qty', '>=', $quantity)
->first();
if ($wholesalePrice) {
$price = $wholesalePrice->price;
}
}
$price = self::discount_calculation($product, $price);
}
public static function discount_calculation($product, $price)
{
$discount_applicable = false;
if (
$product->discount_start_date == null ||
(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;
}
}
return $price;
}
public static function tax_calculation($product, $price)
{
$tax = 0;
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;
}
}
return $tax;
}
public static function save_cart_data($cart, $product, $price, $tax, $quantity)
{
$cart->quantity = $quantity;
$cart->product_id = $product->id;
$cart->owner_id = $product->user_id;
$cart->price = $price;
$cart->tax = $tax;
$cart->product_referral_code = null;
if (Cookie::has('referred_product_id') && Cookie::get('referred_product_id') == $product->id) {
$cart->product_referral_code = Cookie::get('product_referral_code');
}
// Cart::create($data);
$cart->save();
}
public static function check_auction_in_cart($carts)
{
foreach ($carts as $cart) {
if ($cart->product->auction_product == 1) {
return true;
}
}
return false;
}
}

View File

@@ -5,7 +5,7 @@
"license": "MIT",
"type": "project",
"require": {
"php": "^8.1",
"php": "^8.0.2",
"aiz-packages/color-code-converter": "dev-main",
"aiz-packages/combination-generate": "dev-main",
"anandsiddharth/laravel-paytm-wallet": "^2.0",
@@ -14,7 +14,6 @@
"fideloper/proxy": "^4.4",
"genealabs/laravel-sign-in-with-apple": "*",
"genealabs/laravel-socialiter": "*",
"google/recaptcha": "^1.3",
"guzzlehttp/guzzle": "^7.5",
"instamojo/instamojo-php": "^0.4.0",
"intervention/image": "^2.5",
@@ -30,6 +29,7 @@
"league/flysystem-aws-s3-v3": "^3.12",
"maatwebsite/excel": "^3.1",
"mehedi-iitdu/core-component-repository": "^2.2",
"mercadopago/dx-php": "^2.5",
"mpdf/mpdf": "^8.1",
"myfatoorah/laravel-package": "^2.1",
"niklasravnsborg/laravel-pdf": "^4.1",

1118
desarrollo/composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -100,7 +100,7 @@ return [
|
*/
'locale' => env('DEFAULT_LANGUAGE', 'es'),
'locale' => env('DEFAULT_LANGUAGE', 'en'),
/*
|--------------------------------------------------------------------------
@@ -113,7 +113,7 @@ return [
|
*/
'fallback_locale' => 'es',
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
@@ -169,8 +169,6 @@ return [
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
KingFlamez\Rave\RaveServiceProvider::class,
/*
* Package Service Providers...
@@ -186,7 +184,6 @@ return [
App\Providers\RouteServiceProvider::class,
Spatie\Permission\PermissionServiceProvider::class,
],
@@ -239,8 +236,6 @@ return [
'PDF' => niklasravnsborg\LaravelPdf\Facades\Pdf::class,
'Str' => Illuminate\Support\Str::class,
'Rave' => KingFlamez\Rave\Facades\Rave::class,
'Recaptcha' => \ReCaptcha\ReCaptcha::class,
],
];

View File

@@ -55,13 +55,24 @@ return [
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'aws' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
// 'scheme' => 'http',
],
'backblaze' => [
'driver' => 's3',
'key' => env('BACKBLAZE_ACCESS_KEY_ID'),
'secret' => env('BACKBLAZE_SECRET_ACCESS_KEY'),
'region' => env('BACKBLAZE_DEFAULT_REGION'),
'bucket' => env('BACKBLAZE_BUCKET'),
'url' => env('BACKBLAZE_URL'),
'endpoint' => env('BACKBLAZE_ENDPOINT'),
],
],

View File

@@ -162,7 +162,7 @@ return [
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
| the cookie from being sent to you if it cannot be done securely.
|
*/

1
desarrollo/description Normal file
View File

@@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.

View File

@@ -1,15 +0,0 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.yml]
indent_size = 2

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +0,0 @@
/**
* Owl Carousel v2.3.4
* Copyright 2013-2018 David Deutsch
* Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
*/
.owl-carousel,.owl-carousel .owl-item{-webkit-tap-highlight-color:transparent;position:relative}.owl-carousel{display:none;width:100%;z-index:1}.owl-carousel .owl-stage{position:relative;-ms-touch-action:pan-Y;touch-action:manipulation;-moz-backface-visibility:hidden}.owl-carousel .owl-stage:after{content:".";display:block;clear:both;visibility:hidden;line-height:0;height:0}.owl-carousel .owl-stage-outer{position:relative;overflow:hidden;-webkit-transform:translate3d(0,0,0)}.owl-carousel .owl-item,.owl-carousel .owl-wrapper{-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;-ms-backface-visibility:hidden;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0)}.owl-carousel .owl-item{min-height:1px;float:left;-webkit-backface-visibility:hidden;-webkit-touch-callout:none}.owl-carousel .owl-item img{display:block;width:100%}.owl-carousel .owl-dots.disabled,.owl-carousel .owl-nav.disabled{display:none}.no-js .owl-carousel,.owl-carousel.owl-loaded{display:block}.owl-carousel .owl-dot,.owl-carousel .owl-nav .owl-next,.owl-carousel .owl-nav .owl-prev{cursor:pointer;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.owl-carousel .owl-nav button.owl-next,.owl-carousel .owl-nav button.owl-prev,.owl-carousel button.owl-dot{background:0 0;color:inherit;border:none;padding:0!important;font:inherit}.owl-carousel.owl-loading{opacity:0;display:block}.owl-carousel.owl-hidden{opacity:0}.owl-carousel.owl-refresh .owl-item{visibility:hidden}.owl-carousel.owl-drag .owl-item{-ms-touch-action:pan-y;touch-action:pan-y;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.owl-carousel.owl-grab{cursor:move;cursor:grab}.owl-carousel.owl-rtl{direction:rtl}.owl-carousel.owl-rtl .owl-item{float:right}.owl-carousel .animated{animation-duration:1s;animation-fill-mode:both}.owl-carousel .owl-animated-in{z-index:0}.owl-carousel .owl-animated-out{z-index:1}.owl-carousel .fadeOut{animation-name:fadeOut}@keyframes fadeOut{0%{opacity:1}100%{opacity:0}}.owl-height{transition:height .5s ease-in-out}.owl-carousel .owl-item .owl-lazy{opacity:0;transition:opacity .4s ease}.owl-carousel .owl-item .owl-lazy:not([src]),.owl-carousel .owl-item .owl-lazy[src^=""]{max-height:0}.owl-carousel .owl-item img.owl-lazy{transform-style:preserve-3d}.owl-carousel .owl-video-wrapper{position:relative;height:100%;background:#000}.owl-carousel .owl-video-play-icon{position:absolute;height:80px;width:80px;left:50%;top:50%;margin-left:-40px;margin-top:-40px;background:url(owl.video.play.png) no-repeat;cursor:pointer;z-index:1;-webkit-backface-visibility:hidden;transition:transform .1s ease}.owl-carousel .owl-video-play-icon:hover{-ms-transform:scale(1.3,1.3);transform:scale(1.3,1.3)}.owl-carousel .owl-video-playing .owl-video-play-icon,.owl-carousel .owl-video-playing .owl-video-tn{display:none}.owl-carousel .owl-video-tn{opacity:0;height:100%;background-position:center center;background-repeat:no-repeat;background-size:contain;transition:opacity .4s ease}.owl-carousel .owl-video-frame{position:relative;z-index:1;height:100%;width:100%}

View File

@@ -1,440 +0,0 @@
:root {
--light-purple: #F6F4FE;
--purple: #6A49F2;
--bg-purple: #6A49F2;
--dark-purple: #32236F;
--body-text-purple: #3E3F66;
--text-white: #ffffff;
--bg-white: #ffffff;
--slider-dots-color: #D4D2DD;
--light-bg: #DFDAF3;
}
/* ------Media-Query-Start--------- */
@media screen and (max-width:1600px) {
footer .top_footer.has_bg {background-repeat: repeat-y; background-position: 0 50px;}
.why_we_section .why_inner {margin: 0 15px;}
.youtube-video .modal-dialog {max-width: 1040px !important;}
}
@media screen and (max-width:1300px) {
/* features section */
.features_section .feature_detail .feature_box {width: 350px;}
.features_section .feature_detail .left_data {padding-left: 75px;}
.features_section .feature_detail .right_data {padding-right: 75px;}
}
@media screen and (max-width:1200px) {
.row_am {padding: 50px 0;}
/* navigation bar section */
.navbar-expand-lg .navbar-nav .nav-link {padding: 5px 8px;}
.navbar-expand-lg .navbar-nav .nav-link.dark_btn {padding: 9px 30px;}
.navbar-expand-lg .navbar-nav .has_dropdown .drp_btn {right: 5px;}
.banner_section .banner_slider .right_icon {right: -30px;}
/* features section */
.features_section .feature_detail .feature_box {width: 300px;}
.features_section .feature_detail .left_data {padding-left: 15px;}
.features_section .feature_detail .right_data {padding-right: 15px;}
/* about app section */
.about_app_section .about_text .app_statstic li {width: 210px; padding-left: 20px;}
.about_app_section .about_text .app_statstic li p:first-child {font-size: 30px;}
/* modern ui section */
.modern_ui_section .ui_images::before {width: 475px; height: 475px;}
.modern_ui_section .ui_images .right_img img:nth-child(1) {margin-left: -60px;}
.modern_ui_section .ui_images .right_img img:nth-child(2) {margin-left: -140px;}
/* download app section */
.free_app_section .container .free_app_inner .free_img img {transform: scale(.8);}
.free_app_section .container .free_app_inner .free_img img:last-child {margin-left: -120px;}
.free_app_section .container .free_app_inner .free_img {margin-top: -180px;}
/* newsletter section */
.newsletter_box .section_title {width: 60%;}
.newsletter_box .section_title h2 {font-size: 24px; letter-spacing: 1px;}
.newsletter_box form .form-group .form-control {width: 250px;}
.youtube-video .modal-dialog {max-width: 940px !important;}
.app_solution_section .app_images ul li:nth-child(2) {width: 45%; left: 0;}
.app_solution_section .app_images ul li:nth-child(3) {width: 50%; right: 0;}
.experts_team_section .experts_box .text span {min-height: 50px; display: block; margin-bottom: 10px;}
.review_list_section .review_box h3 {font-size: 16px;}
.review_list_section .review_box p {font-size: 14px;}
.review_list_section .review_box .reviewer .text span {font-size: 14px;}
.contact_page_section .contact_inner {margin-top: -120px;}
.contact_page_section .contact_inner .contact_form {width: 520px; padding: 50px 30px;}
.contact_page_section .contact_inner .contact_info {width: 350px;}
.contact_page_section .contact_inner .section_title h2 {font-size: 34px;}
.bred_crumb {min-height: 400px;}
.bred_crumb::after {background-size: 100%; height: 110px;}
.blog_detail_section .blog_inner_pannel {margin-top: -100px; padding: 30px;}
}
@media screen and (max-width:992px) {
/* navigation section */
.navbar-toggler-icon {display: flex; align-items: center; color: var(--body-text-purple); justify-content: flex-end;}
.white_header .toggle-bar {color: var(--text-white);}
.free_app_section .container .free_app_inner .free_text .section_title h2 , .section_title h2 {font-size: 30px;}
header.fix_style {padding: 5px 0;}
.white_header .navbar-collapse {position: absolute; top: 110%; width: 100%;}
.white_header .navbar-expand-lg .navbar-nav .nav-link, .white_header .navbar-expand-lg .navbar-nav .has_dropdown .drp_btn {color: var(--body-text-purple);}
.white_header .navbar-expand-lg .navbar-nav .nav-link.dark_btn {background-color: var(--bg-purple); color: var(--text-white);}
.banner_section {text-align: center;}
.banner_section .app_btn , .banner_section .used_app {justify-content: center;}
/* navigation section */
.navbar-expand-lg .navbar-nav {align-items: flex-start;}
.navbar-toggler {padding-right: 0; line-height: 1.7;}
.navbar-expand-lg .navbar-nav {padding: 20px 15px; background-color: var(--bg-white); border-radius: 15px; box-shadow: 0 4px 10px #EDE9FE;}
.navbar-expand-lg .navbar-nav .nav-link.dark_btn {margin-left: 0; margin-top: 15px;}
.navbar-expand-lg .navbar-nav .has_dropdown {flex-direction: column; align-items: flex-start; width: 100%; box-shadow: none;}
.navbar-expand-lg .navbar-nav .has_dropdown:hover {box-shadow: none;}
.navbar-expand-lg .navbar-nav .has_dropdown .drp_btn {position: absolute; right: 0; padding: 0 10px;}
.navbar-expand-lg .navbar-nav .has_dropdown .sub_menu {position: relative; opacity: 1; pointer-events: all; top: auto; background-color: transparent; width: 100%; border-bottom: 1px solid #6b49f268; border-radius: 0; width: 100%; min-width: 100%; max-width: 100%; margin-left: 10px; display: none; box-shadow: none; margin-top: 0;}
.navbar-expand-lg .navbar-nav .has_dropdown .sub_menu ul {padding: 0; margin-top: 0;}
.navbar-expand-lg .navbar-nav .has_dropdown .sub_menu ul li a {padding: 5px 10px; display: block; padding-left: 0;}
.navbar-expand-lg .navbar-nav .has_dropdown:hover .sub_menu {margin-top: 0;}
/* banner section */
.banner_section .banner_text h1 {font-size: 40px;}
.banner_section .banner_slider {margin-top: 50px;}
.banner_section .banner_slider .left_icon {left: 0;}
.banner_section .banner_slider .right_icon {right: 0;}
/* features section */
.features_section .feature_detail .feature_img {width: 275px;}
.features_section .feature_detail .feature_box .data_block {margin-bottom: 30px;}
.features_section .feature_detail .feature_box {width: 200px;}
/* about app section */
.about_app_section .row {flex-direction: column-reverse;}
.about_app_section .about_img {justify-content: flex-start; margin-top: 75px; margin-left: 0;}
.about_app_section .about_img::before {left: 50%;}
.about_app_section .about_img .screen_img {margin-left: -170px;}
.about_app_section .about_text .app_statstic {justify-content: flex-start;}
.about_app_section .about_text .app_statstic li {width: 35%; margin-right: 30px;}
.about_app_section .about_img::before {left: 35%;}
/* modern ui section */
.modern_ui_section .ui_images {margin-top: 30px;}
.modern_ui_section .ui_text {padding-right: 0;}
.modern_ui_section .ui_images .right_img {display: flex; flex-direction: column; align-items: center;}
/* how it work section */
.how_it_works .step_block ul li .step_text, .how_it_works .step_block ul li .step_img {width: 280px;}
.how_it_works .yt_video .thumbnil a {top: 57%;}
.how_it_works .yt_video .thumbnil a span {font-size: 20px;}
/* testimonial section */
#testimonial_slider {max-width: 500px;}
/* pricing section */
.pricing_section .pricing_pannel .pricing_block {padding-left: 15px; padding-right: 15px; min-height: 600px; padding-top: 30px;}
.pricing_section .pricing_pannel .pricing_block .price {font-size: 36px;}
.pricing_section .pricing_pannel .pricing_block .benifits li p {font-size: 14px;}
/* interface section */
.interface_section .screen_slider {min-height: 550px;}
/* download app section */
.free_app_section .container .free_app_inner {padding: 20px 15px;}
.free_app_section .container .free_app_inner .free_img img {transform: scale(.7);}
.free_app_section .container .free_app_inner .free_img img:last-child {margin-left: -180px;}
.free_app_section .container .free_app_inner .free_text .app_btn li a {padding: 10px 20px;}
/* latest story section */
.latest_story {margin-bottom: 40px;}
.latest_story .story_box .story_text {padding: 15px;}
/* newsletter section */
.newsletter_box {flex-direction: column; padding: 30px 20px;}
.newsletter_box .section_title , .newsletter_box form {width: 100%; margin: 10px 0; justify-content: center;}
.newsletter_box form .form-group .form-control {width: 350px;}
.newsletter_box .section_title h2, .newsletter_box .section_title p {text-align: center;}
/* footer section */
footer .top_footer .logo , footer h3 {margin-bottom: 20px;}
footer .abt_side {margin-bottom: 50px;}
footer .top_footer .try_out {margin-left: 0;}
footer .top_footer .col-md-6 {margin-bottom: 15px;}
footer .top_footer.has_bg {background-position: center;}
/* Bred Crumb */
.bred_crumb {min-height: 350px;}
.bred_crumb .bred_text h1 {font-size: 30px;}
.bred_crumb::after {background-size: 100%; height: 90px; bottom: -5px;}
.bred_crumb .bred_text .search_bar form .form-group {height: 50px;}
.bred_crumb .bred_text .search_bar form .form-group .btn {width: 46px; height: 46px; line-height: 46px;}
.bred_crumb .banner_shape3 { top: 240px; animation: mymove 3s infinite; }
.app_solution_section .app_images {margin-top: 30px;}
.app_solution_section .app_images ul li:nth-child(2) {text-align: right;}
.app_solution_section .app_text p {padding-right: 0;}
.app_solution_section .app_text .section_title {text-align: center;}
.app_solution_section .app_images {margin-top: 70px;}
.app_solution_section .app_images::before {width: 350px; height: 350px;}
.why_we_section .why_inner {padding: 35px 0; padding-bottom: 0px;}
.why_we_section .why_inner .why_box {margin-bottom: 50px; text-align: center;}
.why_we_section .why_inner .why_box .icon {margin-bottom: 30px;}
.experts_team_section .experts_box .text span {min-height: auto;}
.query_inner .white_btn {font-size: 14px;}
.blog_list_main .blog_text {margin-top: 30px;}
.blog_detail_section .blog_inner_pannel {margin-top: -100px; padding: 30px;}
.blog_detail_section .blog_inner_pannel .info ul {padding-left: 30px;}
.comment_section ul li .comment { width: calc(100% - 280px); margin-left: 20px;}
.blog_detail_section .blog_inner_pannel .quote_block {padding: 55px 30px 35px 30px;}
.contact_page_section .contact_inner {flex-direction: column; margin-top: 60px;}
.contact_page_section .contact_inner .contact_form {width: 100%;}
.contact_page_section .contact_inner .contact_info {width: 100%; margin-top: 50px;}
}
@media screen and (max-width:767px) {
body {font-size: 14px; text-align: center;}
.row_am {padding: 30px 0;}
.section_title p br {display: none;}
.free_app_section .container .free_app_inner .free_text .section_title h2, .section_title h2 {font-size: 24px;}
/* navbar section */
.navbar {padding-top: 15px;}
.navbar-expand-lg .navbar-nav .has_dropdown .sub_menu ul li a {text-align: left; line-height: 1.5; font-size: 14px;}
/* banner section */
.banner_section {margin-top: 60px;}
.banner_section .banner_text h1 {font-size: 30px;}
.banner_section .app_btn , .banner_section .used_app {justify-content: center;}
.banner_section .app_btn li:last-child {margin-left: 0;}
.banner_section .app_btn li {margin: 0 15px;}
.banner_section .app_btn li a {padding: 10px 20px;}
.banner_section .app_btn li a img {height: 25px;}
.banner_section .banner_slider .left_icon {left: -40px;}
.banner_section .banner_slider .right_icon {right: -40px; z-index: 1000;}
.banner_section .banner_slider::before {width: 350px; height: 350px;}
/* trusted logo section */
.trusted_section .company_logos {padding-top: 0;}
.trusted_section .company_logos img {max-width: 70%;}
/* features section */
.features_section .feature_detail {flex-direction: column-reverse; padding-top: 30px; margin-top: 0;}
.features_section .feature_detail .feature_img {position: relative; top: auto; left: auto; transform: none; width: 75%; margin: 0 auto;}
.features_section .feature_detail .feature_box {width: 100%; padding: 0 15px; text-align: center;}
.features_section .feature_detail .left_data .data_block .icon {margin-right: 0;}
.features_section .feature_detail .right_data .data_block .icon {margin-left: 0;}
.features_section .feature_detail .feature_box .data_block {margin-bottom: 0; margin-top: 30px;}
/* about app section */
.about_app_section .about_text , .about_app_section .about_text .section_title {text-align: center;}
.about_app_section .about_text .app_statstic {margin-top: 0; justify-content: space-between;}
.about_app_section .about_text .app_statstic li {width: 48%; margin-right: 0;}
.about_app_section .about_text .app_statstic li p:first-child {font-size: 18px;}
.about_app_section .about_img {margin: 0; margin-top: 50px; justify-content: center;}
.about_app_section .about_img::before {width: 350px; height: 350px;}
/* modern ui section */
.modern_ui_section .ui_images {margin-top: 10px;}
.modern_ui_section .section_title {text-align: center;}
.modern_ui_section .design_block li {padding-left: 0; margin-bottom: 30px;}
.modern_ui_section .design_block li::before {position: relative; left: auto; top: auto; display: inline-block;}
.modern_ui_section .ui_images img {max-width: 100%;}
.modern_ui_section .ui_images::before {width: 350px; height: 350px;}
.modern_ui_section .ui_images .left_img {width: 70%;}
.modern_ui_section .ui_images .right_img {justify-content: center;}
.modern_ui_section .ui_images .right_img img:nth-child(1) {top: 0; width: 100px;}
.modern_ui_section .ui_images .right_img img:nth-child(3) {margin-top: 0;}
/* how it work section */
.how_it_works .how_it_inner {padding: 50px 15px;}
.how_it_works .step_block ul {padding-top: 30px;}
.how_it_works .step_block ul li , .how_it_works .step_block ul li:nth-child(2) {flex-direction: column; padding-left: 30px;}
.how_it_works .step_block ul li .step_text h4 {font-size: 18px;}
.how_it_works .step_block ul li::before {left: 0; transform: none; height: calc(100% + 10px); top: 40px;}
.how_it_works .step_block ul li:first-child::before {height: calc(100% + 50px);}
.how_it_works .step_block ul li:first-child::after {left: -5px; transform: none; display: none;}
.how_it_works .step_block ul li .step_text, .how_it_works .step_block ul li .step_img ,
.how_it_works .step_block ul li:nth-child(2) .step_text, .how_it_works .step_block ul li:nth-child(2) .step_img {text-align: center;}
.how_it_works .step_block ul li .step_text, .how_it_works .step_block ul li .step_img {width: 100%;}
.how_it_works .step_block ul li .step_number {position: absolute; top: -5px; left: -23px; width: 50px; height: 50px;}
.how_it_works .step_block ul li:last-child::before {opacity: 0;}
.how_it_works .step_block ul li .step_number h3 {font-size: 15px; margin-bottom: 0; margin-top: -2px;}
.how_it_works .yt_video {margin-top: -50px;}
.how_it_works .yt_video .thumbnil {height: 300px; border-radius: 15px;}
.how_it_works .yt_video .thumbnil img {height: 100%; object-fit: cover; object-position: center; border-radius: 15px;}
.how_it_works .yt_video .thumbnil a {width: 100%;}
.how_it_works .yt_video .thumbnil a .play_btn::after {width: 140px; height: 140px;}
.how_it_works .yt_video .thumbnil a .play_btn::before {width: 120px; height: 120px;}
.how_it_works .yt_video .thumbnil a .play_btn img {height: auto;}
/* testimonial section */
.testimonial_section .testimonial_block {margin: 0;}
.testimonial_section .testimonial_block .avtar_faces {display: none;}
.testimonial_section .testimonial_block .testimonial_slide_box {width: 100%;}
/* pricing section */
.pricing_section .pricing_pannel .pricing_block {min-height: auto; padding: 30px 15px;}
.pricing_section .pricing_pannel .pricing_block .icon {margin-bottom: 15px;}
.pricing_section .contact_text {margin-top: -20px;}
/* faq section */
.faq_section .faq_panel .card-header h2 {text-align: left;}
.faq_section .faq_panel .card-header .btn {font-size: 16px; padding-right: 30px; text-align: left;}
.faq_section .faq_panel .card-body p {text-align: left;}
/* interface section */
.interface_section .screen_slider { /*min-height: 720px;*/}
.interface_section .owl-item .screen_frame_img img {transform: scale(1);}
/* download section */
.free_app_section .container .free_app_inner {padding: 50px 15px; padding-bottom: 0; z-index: 99;}
.free_app_section .container .free_app_inner .free_img {margin-top: 0; justify-content: center;}
.free_app_section .container .free_app_inner .free_img img {max-width: 100%;}
.free_app_section .container .free_app_inner .free_text .section_title {text-align: center;}
.free_app_section .container .free_app_inner .free_text .app_btn {flex-direction: column;}
.free_app_section .container .free_app_inner .free_text .app_btn li a {width: 200px; text-align: center;}
.free_app_section .container .free_app_inner .free_text .app_btn li:last-child {margin-left: 0; margin-top: 15px;}
/* latest story section */
.latest_story .story_box {margin-bottom: 30px;}
/* newsletter section */
.newsletter_box form {flex-direction: column; align-items: center;}
.newsletter_box form .form-group {width: 100%;}
.newsletter_box form .form-group .form-control {width: 100%; margin-bottom: 15px;}
.newsletter_box .section_title p {font-size: 13px;}
/* footer section */
footer .links , footer .abt_side {margin-bottom: 30px;}
footer .top_footer .social_media {justify-content: center;}
footer .top_footer .social_media li a {margin: 0 5px;}
footer .top_footer .try_out {margin-left: 0;}
footer .app_btn li a {margin: 0 auto;}
footer .bottom_footer .developer_text {text-align: center; margin-top: 10px;}
footer .go_top {right: 10px;}
footer .top_footer .col-md-6 {margin-bottom: 0px;}
/* animation line section */
.anim_line , .anim_line.dark_bg {width: 140%;}
/* latest story section */
.latest_story .story_box .story_img img {width: 100%;}
/* go top button section */
.go_top {bottom: 30px; z-index: 999;}
.purple_backdrop {display: none;}
/* Bread-Crumb */
.bred_crumb {min-height: 330px;}
.bred_crumb .bred_text h1 {font-size: 24px;}
.bred_crumb .bred_text .search_bar form .form-group {height: 50px;}
.bred_crumb .bred_text .search_bar form .form-group .btn {width: 46px; height: 46px; line-height: 46px;}
.bred_crumb .bred_text {padding: 0 15px; margin-top: 15px;}
.bred_crumb::after {background-size: cover; height: 100px;}
.blog_list_main .blog_text .section_title , .blog_list_story .story_box {text-align: center;}
.why_we_section .why_inner {padding-bottom: 10px;}
.experts_team_section .experts_box {padding: 20px; margin-bottom: 15px;}
.pagination_block ul li:not(:first-child , :last-child) a {width: 24px; height: 24px; line-height: 24px; margin: 0 3px; font-size: 12px;}
.blog_detail_bredcrumb.bred_crumb .bred_text {margin-top: -10px;}
.blog_detail_section .blog_inner_pannel {margin-top: -70px; padding: 25px 20px;}
.blog_detail_section .blog_inner_pannel .section_title {margin-bottom: 20px;}
.blog_detail_section .blog_inner_pannel .section_title h2 {font-size: 22px;}
.blog_detail_section .blog_inner_pannel .info h3 {font-size: 18px;}
.blog_detail_section .blog_inner_pannel .info ul {text-align: left; padding-left: 0;}
.blog_detail_section .blog_inner_pannel .two_img {margin-bottom: 0;}
.blog_detail_section .blog_inner_pannel .two_img img {margin: 10px 0;}
.blog_detail_section .blog_inner_pannel .quote_block .q_icon {left: 50%; transform: translateX(-50%);}
.blog_detail_section .blog_inner_pannel .quote_block {padding: 55px 20px 35px 20px;}
.blog_detail_section .blog_inner_pannel .quote_block h2 {font-size: 18px; line-height: 1.4;}
.blog_detail_section .blog_inner_pannel .blog_authore {flex-direction: column;}
.blog_detail_section .blog_inner_pannel .blog_authore .authore_info {margin-bottom: 30px;}
.blog_detail_section .blog_inner_pannel .blog_authore .authore_info .text h3 {font-size: 18px;}
.comment_section ul li {flex-direction: column; padding: 20px 0; text-align: left;}
.comment_section ul li .comment {width: 100%; margin-left: 0;}
.comment_section ul li .authore_info {width: 100%; margin-bottom: 15px;}
.comment_section ul li.replay_comment {margin-left: 30px;}
.comment_section ul li .authore_info .text {width: auto;}
.comment_form_section form .form-group .form-control {height: 45px; font-size: 14px; margin-bottom: 15px;}
.signup_form {width: calc(100% - 30px); margin: 0 15px;}
.signup_form form {padding: 0 20px;}
.signup_form form .form-group .form-control {font-size: 14px; height: 50px;}
.signup_form .or_option .google_btn {min-width: 275px; padding: 12px 10px;}
.signup_section .back_btn {top: 15px;}
.signup_section .top_part {padding-top: 35px; padding-bottom: 35px;}
.review_freeapp {margin: 0 0 40px 0;}
.review_list_section .review_box .rating ul ,
.review_list_section .review_box .reviewer {justify-content: flex-start; text-align: center;}
.review_list_section .review_box .reviewer .text {width: auto; text-align: left;}
.review_list_section .review_box {text-align: left;}
.contact_page_section .contact_inner {margin-top: 40px;}
.contact_page_section .contact_inner .contact_form {padding: 30px 20px;}
.contact_page_section .contact_inner .section_title h2 {font-size: 24px;}
.contact_page_section .contact_inner .contact_form form .form-group .form-control {height: 50px; font-size: 14px;}
.contact_page_section .contact_inner .contact_form form .term_check label {text-align: left; line-height: 1.3;}
.contact_page_section .contact_inner .contact_form form .term_check {align-items: flex-start;}
.contact_page_section .contact_inner .contact_info .section_title {text-align: center;}
.contact_page_section .contact_inner .contact_info .btn {margin-bottom: 30px;}
.contact_page_section .contact_inner .contact_info .contact_info_list li {flex-direction: column;}
.contact_page_section .contact_inner .contact_info .contact_info_list li .img {width: 100%; margin: 0;}
.contact_page_section .contact_inner .contact_info .contact_info_list li .text {width: 100%; margin-top: 10px;}
.map_section {margin: 15px 0;}
}
@media screen and (max-width:640px) {
.features_section .feature_detail .feature_box { justify-content: center; margin: 0 auto; }
.bred_crumb .banner_shape1, .banner_shape2, .banner_shape3 { display: none;}
.query_section .banner_shape1, .banner_shape2, .banner_shape3 { display: none;}
}
@media screen and (max-width:479px) {
/* about app section */
.about_app_section .about_img::before {left: 49%;}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 2.3 MiB

Some files were not shown because too many files have changed in this diff Show More