132 lines
3.6 KiB
PHP
Executable file
132 lines
3.6 KiB
PHP
Executable file
<?php
|
|
|
|
namespace App\Http\Controllers\Portal;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Product;
|
|
use App\Models\ShoppingPayment;
|
|
use App\User;
|
|
use Auth;
|
|
use Carbon\Carbon;
|
|
use Config;
|
|
use Request;
|
|
use Storage;
|
|
use Util;
|
|
|
|
class InController extends Controller
|
|
{
|
|
/**
|
|
* Create a new controller instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
}
|
|
|
|
|
|
public function index()
|
|
{
|
|
if(Auth::guard('user')->check()){
|
|
return redirect(route('portal.change_login'));
|
|
}
|
|
if(!Auth::guard('customers')->check()){ // if () {
|
|
return redirect(route('portal.login.form'));
|
|
}
|
|
return redirect(route('portal.dashboard'));
|
|
|
|
}
|
|
|
|
public function changeLogin(){
|
|
if(Auth::guard('customers')->check()){
|
|
return redirect(route('portal.dashboard'));
|
|
}
|
|
if(Auth::guard('user')->check()){
|
|
return view('portal.auth.change');
|
|
|
|
}
|
|
return redirect(route('portal.login.form'));
|
|
|
|
}
|
|
|
|
public function dashboard()
|
|
{
|
|
if(!Auth::guard('customers')->check()){
|
|
return redirect(route('portal.login.form'));
|
|
}
|
|
$data = [
|
|
'user' => Auth::guard('customers')->user(),
|
|
'now' => Carbon::now(),
|
|
];
|
|
return view('portal.dashboard', $data);
|
|
}
|
|
|
|
public function loadingModal(){
|
|
|
|
$data = Request::all();
|
|
|
|
$response = "";
|
|
$status = false;
|
|
if(isset($data['action'])){
|
|
if($data['action'] === 'user-order-show-product'){
|
|
$product = Product::find($data['id']); //current user form order
|
|
$ret = view("admin.modal.show_product", compact('product', 'data'))->render();
|
|
return response()->json(['response' => $data, 'html'=>$ret, 'status'=>$status]);
|
|
}
|
|
}
|
|
|
|
$data = Request::get('data');
|
|
$target = Request::get('target');
|
|
if($data === "data_protection"){
|
|
$data = [
|
|
'modal' => true,
|
|
'user_shop' => true,
|
|
'isMivitaShop' => false,
|
|
];
|
|
$response = view('legal.data_protect_de', $data)->render();
|
|
}
|
|
if($data === "imprint"){
|
|
$data = [
|
|
'modal' => true,
|
|
'user_shop' => Util::getUserShop(),
|
|
];
|
|
$response = view('legal.imprint_de', $data)->render();
|
|
}
|
|
if($data === "shop_term_of_use"){
|
|
$data = [
|
|
'modal' => true,
|
|
'user_shop' => Util::getUserShop(),
|
|
];
|
|
$response = view('legal.shop_term_of_use_de', $data)->render();
|
|
}
|
|
if($data === "agb"){
|
|
$data = [
|
|
'modal' => true,
|
|
'user_shop' => Util::getUserShop(),
|
|
];
|
|
$response = view('legal.agb_de', $data)->render();
|
|
}
|
|
if(Request::ajax()) {
|
|
return response()->json(['response' => $response, 'target'=>$target]);
|
|
}
|
|
abort(404);
|
|
}
|
|
|
|
|
|
|
|
/* public function goToShop(){
|
|
|
|
if(!Auth::guard('customers')->check()){
|
|
return redirect(config('app.protocol') . config('app.domain') . config('app.tld_shop'));
|
|
}
|
|
$customer = Auth::guard('customers')->user();
|
|
//subdmain for member
|
|
$member = User::where('email', $customer->email)->first();
|
|
if($member){
|
|
return redirect(config('app.protocol') . $member->subdomain . config('app.tld_care'));
|
|
}
|
|
// $customer->member_id
|
|
|
|
// return redirect(config('app.protocol') . config('app.domain') . config('app.tld_shop'));
|
|
}*/
|
|
}
|