Actualizacuion de Rama Kquiroz
This commit is contained in:
@@ -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'));
|
||||
|
||||
Reference in New Issue
Block a user