10.April 2026
This commit is contained in:
parent
a00c42e770
commit
f58c709945
208 changed files with 19280 additions and 2914 deletions
|
|
@ -2,26 +2,24 @@
|
|||
|
||||
namespace App\Http\Controllers\Web;
|
||||
|
||||
|
||||
use Yard;
|
||||
use Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Category;
|
||||
use App\Models\IqSite;
|
||||
use App\Models\Product;
|
||||
use App\Models\ProductCategory;
|
||||
use App\Services\LocaleGuard;
|
||||
use App\Services\Shop;
|
||||
use App\Services\Util;
|
||||
use App\Models\Product;
|
||||
use App\Models\Category;
|
||||
use App\Models\ProductCategory;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Request;
|
||||
|
||||
class SiteController extends Controller
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->setIPInfo();
|
||||
$products = ['aloe-vera-gel-99', 'aloe-vera-saft-500-ml', 'aloe-vera-lippenbalsam'];
|
||||
// $set_products = ['aloe-vera-cleaner-set', 'aloe-vera-koerper-set', 'aloe-vera-repair-set'];
|
||||
$set_products = ['aloe-vera-koerper-set', 'baby-set', 'aloe-vera-gel-set'];
|
||||
$set_products = ['aloe-vera-koerper-set', 'baby-set', 'aloe-vera-gel-set'];
|
||||
$data = [
|
||||
'products' => Product::whereIn('slug', $products)->where('active', true)->whereJsonContains('show_on', '1')->get(),
|
||||
'set_products' => Product::whereIn('slug', $set_products)->where('active', true)->whereJsonContains('show_on', '1')->get(),
|
||||
|
|
@ -34,9 +32,9 @@ class SiteController extends Controller
|
|||
return view('web.index', $data);
|
||||
}
|
||||
|
||||
public function domainCheck()
|
||||
public function domainCheck()
|
||||
{
|
||||
die("checked");
|
||||
exit('checked');
|
||||
}
|
||||
|
||||
public function changeLang()
|
||||
|
|
@ -48,8 +46,12 @@ class SiteController extends Controller
|
|||
if (strtolower($data['change_country_id']) === strtolower($code)) {
|
||||
\Session::put('user_init_country', strtolower($code));
|
||||
\Session::forget('user_init_country_options');
|
||||
\Session::put('locale', strtolower($data['change_locale_id']));
|
||||
$locale = LocaleGuard::normalize($data['change_locale_id'] ?? null);
|
||||
if ($locale !== null) {
|
||||
\Session::put('locale', $locale);
|
||||
}
|
||||
Shop::initUserShopLang($country, 'webshop');
|
||||
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
|
@ -58,40 +60,41 @@ class SiteController extends Controller
|
|||
|
||||
private function setIPinfo()
|
||||
{
|
||||
//wurde schon gesetzt //cache
|
||||
// wurde schon gesetzt //cache
|
||||
$country = strtolower(Shop::getIPDatabaseInfo());
|
||||
if (\Session::has('user_init_country')) {
|
||||
return;
|
||||
}
|
||||
if (config('app.ipinfo')) {
|
||||
$country = strtolower(Shop::getIPDatabaseInfo());
|
||||
if ($country === 'de') { //$locale de - init AT
|
||||
if ($country === 'de') { // $locale de - init AT
|
||||
\Session::put('user_init_country', $country);
|
||||
|
||||
return;
|
||||
}
|
||||
if ($country === 'error') { //$locale at - init AT
|
||||
if ($country === 'error') { // $locale at - init AT
|
||||
$country = 'de';
|
||||
}
|
||||
} else {
|
||||
$country = 'de';
|
||||
}
|
||||
|
||||
//$locale = strtolower(\App::getLocale());
|
||||
//ist default
|
||||
// $locale = strtolower(\App::getLocale());
|
||||
// ist default
|
||||
|
||||
//sprache
|
||||
// sprache
|
||||
if (array_key_exists($country, \App\Services\UserService::getTransChange())) {
|
||||
\Session::put('user_init_country', $country);
|
||||
\Session::put('locale', $country);
|
||||
\App::setLocale($country);
|
||||
} else {
|
||||
//default EN
|
||||
// default EN
|
||||
\Session::put('user_init_country', 'de');
|
||||
\Session::put('locale', 'de');
|
||||
\App::setLocale('de');
|
||||
}
|
||||
|
||||
//bestelland / versandland
|
||||
// bestelland / versandland
|
||||
if (array_key_exists($country, Shop::getLangChange('webshop'))) {
|
||||
\Session::put('user_init_country_options', $country);
|
||||
} else {
|
||||
|
|
@ -119,6 +122,7 @@ class SiteController extends Controller
|
|||
'p_count' => Product::where('active', true)->whereJsonContains('show_on', '1')->count(),
|
||||
'yard_instance' => 'webshop',
|
||||
];
|
||||
|
||||
return view('web.templates.produkte-show', $data);
|
||||
}
|
||||
}
|
||||
|
|
@ -131,7 +135,7 @@ class SiteController extends Controller
|
|||
$headline_image = $category->iq_image;
|
||||
}
|
||||
|
||||
$product_categories = ProductCategory::where('category_id', $category->id)->whereHas('product', function ($query) use ($category) {
|
||||
$product_categories = ProductCategory::where('category_id', $category->id)->whereHas('product', function ($query) {
|
||||
$query->where('active', true)->whereJsonContains('show_on', '1');
|
||||
})->orderBy('pos', 'DESC')->get();
|
||||
|
||||
|
|
@ -147,7 +151,8 @@ class SiteController extends Controller
|
|||
'headline_image' => $headline_image,
|
||||
'yard_instance' => 'webshop',
|
||||
];
|
||||
return view('web.templates.' . $site, $data);
|
||||
|
||||
return view('web.templates.'.$site, $data);
|
||||
}
|
||||
}
|
||||
dd($subsite);
|
||||
|
|
@ -163,7 +168,8 @@ class SiteController extends Controller
|
|||
'headline_image' => false,
|
||||
'yard_instance' => 'webshop',
|
||||
];
|
||||
return view('web.templates.' . $site, $data);
|
||||
|
||||
return view('web.templates.'.$site, $data);
|
||||
}
|
||||
$data = [
|
||||
'user_shop' => Util::getUserShop(),
|
||||
|
|
@ -171,14 +177,16 @@ class SiteController extends Controller
|
|||
'yard_instance' => 'webshop',
|
||||
];
|
||||
if ($subsite) {
|
||||
if (!view()->exists('web.templates.' . $subsite)) {
|
||||
if (! view()->exists('web.templates.'.$subsite)) {
|
||||
abort(404);
|
||||
}
|
||||
return view('web.templates.' . $subsite, $data);
|
||||
|
||||
return view('web.templates.'.$subsite, $data);
|
||||
}
|
||||
if (!view()->exists('web.templates.' . $site)) {
|
||||
if (! view()->exists('web.templates.'.$site)) {
|
||||
abort(404);
|
||||
}
|
||||
return view('web.templates.' . $site, $data);
|
||||
|
||||
return view('web.templates.'.$site, $data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue