commit 08-2025
This commit is contained in:
parent
9ae662f63e
commit
480fdc65ed
404 changed files with 65310 additions and 2600431 deletions
|
|
@ -1,12 +1,13 @@
|
|||
<?php
|
||||
namespace App\Services;
|
||||
|
||||
use Yard;
|
||||
use App\Models\Country;
|
||||
use App\Models\UserHistory;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\ShippingCountry;
|
||||
use App\Models\UserHistory;
|
||||
use App\Models\UserShop;
|
||||
use Illuminate\Support\Str;
|
||||
use Request;
|
||||
use Yard;
|
||||
|
||||
class Util
|
||||
{
|
||||
|
|
@ -15,7 +16,7 @@ class Util
|
|||
|
||||
public static function getToken()
|
||||
{
|
||||
return hash_hmac('sha256', str_random(40), config('app.key'));
|
||||
return hash_hmac('sha256', Str::random(40), config('app.key'));
|
||||
}
|
||||
|
||||
public static function uuidToken()
|
||||
|
|
@ -122,10 +123,17 @@ class Util
|
|||
}
|
||||
|
||||
public static function getUserShop(){
|
||||
if(\Session::has('user_shop')){
|
||||
if($user_shop = \Session::get('user_shop')){
|
||||
return $user_shop;
|
||||
}
|
||||
$shop = session('user_shop');
|
||||
if (empty($shop) || !is_object($shop)) {
|
||||
return null;
|
||||
}
|
||||
return $shop;
|
||||
}
|
||||
|
||||
public static function getDefaultUserShop(){
|
||||
$user = \App\User::find(6);
|
||||
if($user && $user->shop){
|
||||
return $user->shop;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -220,17 +228,6 @@ class Util
|
|||
return array_merge($p, $b);
|
||||
}
|
||||
|
||||
public static function isCheckout(){
|
||||
|
||||
if(\Session::has('isCheckout')){
|
||||
if(\Session::get('isCheckout') == true){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static function checkUserLandIsNot($user){
|
||||
|
||||
if(isset($user->account->country_id)){
|
||||
|
|
@ -243,14 +240,35 @@ class Util
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static function getMyMivitaShopUrl($add_url = ""){
|
||||
if(\Session::has('user_shop_domain')){
|
||||
$url = \Session::get('user_shop_domain').$add_url;
|
||||
if (!str_starts_with($url, 'http')) {
|
||||
$url = 'https://' . ltrim($url, '/');
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
//alois sein shop
|
||||
$user = \App\User::find(6);
|
||||
if($user && $user->shop){
|
||||
return config('app.protocol').$user->shop->slug.".".config('app.domain').config('app.tld_care').$add_url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function getMyMivitaPortalUrl($protocol = true){
|
||||
$pro = $protocol ? config('app.protocol') : "";
|
||||
return $pro.config('app.pre_url_portal').config('app.domain').config('app.tld_care');
|
||||
}
|
||||
public static function getMyMivitaUrl($protocol = true){
|
||||
$pro = $protocol ? config('app.protocol') : "";
|
||||
return $pro.config('app.pre_url_crm').config('app.domain').config('app.tld_care');
|
||||
}
|
||||
|
||||
public static function getUserPaymentFor(){
|
||||
if(Yard::instance('shopping')->getYardExtra('user_shop_payment')){
|
||||
return Yard::instance('shopping')->getYardExtra('user_shop_payment');
|
||||
public static function getUserPaymentFor($instance = 'shopping'){
|
||||
if(Yard::instance($instance)->getYardExtra('user_shop_payment')){
|
||||
return Yard::instance($instance)->getYardExtra('user_shop_payment');
|
||||
}
|
||||
if(\Session::has('user_shop_payment')){
|
||||
return \Session::get('user_shop_payment');
|
||||
|
|
@ -268,20 +286,20 @@ class Util
|
|||
return config('app.protocol').$user_shop->slug.".".config('app.domain').config('app.tld_care')."/back/to/shop/".$reference;
|
||||
}
|
||||
}
|
||||
return url("/");
|
||||
return config('app.protocol').config('app.domain').config('app.tld_care');
|
||||
}
|
||||
|
||||
public static function getUserCardBackUrl($uri){
|
||||
public static function getUserCardBackUrl($uri, $instance = 'shopping'){
|
||||
|
||||
if(\Session::has('user_shop')){
|
||||
if(\Session::has('user_shop_domain')){
|
||||
if(\Session::has('back_link')){
|
||||
return \Session::get('back_link');
|
||||
}
|
||||
if(self::getUserPaymentFor() === 3){
|
||||
if(self::getUserPaymentFor($instance) === 3){
|
||||
return \Session::get('user_shop_domain')."/user/membership";
|
||||
}
|
||||
if(self::getUserPaymentFor() === 2){
|
||||
if(self::getUserPaymentFor($instance) === 2){
|
||||
return \Session::get('user_shop_domain')."/user/orders";
|
||||
}
|
||||
return \Session::get('user_shop_domain');
|
||||
|
|
@ -290,7 +308,7 @@ class Util
|
|||
return config('app.protocol').$user_shop->slug.".".config('app.domain').config('app.tld_care').$uri;
|
||||
}
|
||||
}
|
||||
return url($uri);
|
||||
return config('app.protocol').config('app.domain').config('app.tld_care');
|
||||
}
|
||||
|
||||
public static function isMivitaShop(){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue