Statistiken/Abo: Kundenfeedback 2026-07-24 komplett umgesetzt + Steuern: DATEV-Fixes 08+09/2025 (Sammel-Commit Branch-WIP)
Feedback-Umsetzung (dev/2026-07-22/feedback-analyse-2026-07-24.md, alle 10 Punkte):
- VIP-Statistik: eigener Berater ('ich', Linie 0) in Neue-Kundenabos- und beiden Top-10-Listen; Top-10-Umsatz sortiert nach abgerechneten Ist-Punkten + Abo-Anzahl-Spalte; Fußnote nicht-payline-wirksame Punkte (SalesVolumePoints::nonPaylinePoints)
- Führungskräfte-Liste: beide Sichten 'direkt' (an nächster FK abgeschnitten, additiv) und 'gesamt' (komplette Downline), Gesamt-Spalte nach Kundenzählweise
- Team-Abos: je Ebene 'abgerechnet (Monat)' und 'bis zum 25. erwartet'; Payline-Karte mit Teamabo-/Kundenabo-Zählern
- Incentive-Live-Ranking: Qualifizierte zuerst nummeriert (fixt auch isWinner rank<=max_winners)
- Porto: Netto-/Brutto-Kennzeichnung (Berater netto, Endkunden inkl. MwSt., portal_view-Flag; auch CRM-/Shop-Warenkorb + Checkout), Yard::shipping_tax-Fix
- Struktur-Ansicht: Abo-Badges 'A' (eigenes Abo) und '(n)' (Kundenabos) je Teampartner, gebatcht
- Abo-Löschung: Softdelete setzt active=0 (UserAbo deleting-Hook) + Bereinigungs-Migration für gelöschte-aber-aktive Abos
- Doku: technische Analyse + Kundinnen-Feedback-Dokument unter dev/2026-07-22/
- Tests: IncentiveRankingTest, TeamStructureAboBadgesTest, YardShippingTaxTest (neu); BackofficeStatisticsListsTest, TeamAboOverviewTest, PaylineForecastServiceTest, AboAdminDeleteTest, AboOneTimeViewTest erweitert
Außerdem enthalten (Branch-WIP vor dem Feedback): DATEV-Abgleich-Fixes 08+09/2025, USt-ID-Live-Validierung sowie restliche unkommittete Stände (u. a. Abo-Pause-Sprachkeys).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
c06740b9be
commit
d4e9d108ad
137 changed files with 7610 additions and 2955 deletions
|
|
@ -2,9 +2,14 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Acme\Dhl\Models\DhlShipment;
|
||||
use App\Services\HTMLHelper;
|
||||
use App\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* App\Models\ShoppingOrder
|
||||
|
|
@ -23,16 +28,16 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @property int|null $weight
|
||||
* @property int|null $paid
|
||||
* @property string|null $txaction
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property-read \App\User|null $auth_user
|
||||
* @property-read \App\Models\Country $country
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ShoppingOrderItem[] $shopping_order_items
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read User|null $auth_user
|
||||
* @property-read Country $country
|
||||
* @property-read Collection|ShoppingOrderItem[] $shopping_order_items
|
||||
* @property-read int|null $shopping_order_items_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ShoppingPayment[] $shopping_payments
|
||||
* @property-read Collection|ShoppingPayment[] $shopping_payments
|
||||
* @property-read int|null $shopping_payments_count
|
||||
* @property-read \App\Models\ShoppingUser $shopping_user
|
||||
* @property-read \App\Models\UserShop $user_shop
|
||||
* @property-read ShoppingUser $shopping_user
|
||||
* @property-read UserShop $user_shop
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder newQuery()
|
||||
|
|
@ -60,13 +65,13 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
*
|
||||
* @property int|null $member_id
|
||||
* @property string|null $mode
|
||||
* @property-read \App\User|null $member
|
||||
* @property-read \App\Models\UserHistory|null $user_history
|
||||
* @property-read User|null $member
|
||||
* @property-read UserHistory|null $user_history
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereMemberId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereMode($value)
|
||||
*
|
||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property string|null $user_deleted_at
|
||||
*
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrder onlyTrashed()
|
||||
|
|
@ -75,7 +80,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrder withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\ShoppingOrder withoutTrashed()
|
||||
*
|
||||
* @property-read \App\Models\ShippingCountry $shipping_country
|
||||
* @property-read ShippingCountry $shipping_country
|
||||
* @property float|null $shipping_net
|
||||
* @property float|null $subtotal_ws
|
||||
* @property int|null $points
|
||||
|
|
@ -93,21 +98,21 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @property int|null $homeparty_id
|
||||
* @property array|null $api_notice
|
||||
* @property int|null $api_status
|
||||
* @property-read \App\Models\Homeparty|null $homeparty
|
||||
* @property-read Homeparty|null $homeparty
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereHomepartyId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereWpNotice($value)
|
||||
*
|
||||
* @property array|null $tax_split
|
||||
* @property-read \App\Models\UserInvoice|null $user_invoice
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\UserSalesVolume[] $user_sales_volume
|
||||
* @property-read UserInvoice|null $user_invoice
|
||||
* @property-read Collection|UserSalesVolume[] $user_sales_volume
|
||||
* @property-read int|null $user_sales_volume_count
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereTaxSplit($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereApiNotice($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereApiStatus($value)
|
||||
*
|
||||
* @property-read \App\Models\ShoppingCollectOrder|null $shopping_collect_order
|
||||
* @property-read ShoppingCollectOrder|null $shopping_collect_order
|
||||
* @property array|null $net_split
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereNetSplit($value)
|
||||
|
|
@ -122,11 +127,11 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereAboInterval($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereIsAbo($value)
|
||||
*
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \Acme\Dhl\Models\DhlShipment> $dhlOutboundShipments
|
||||
* @property-read Collection<int, DhlShipment> $dhlOutboundShipments
|
||||
* @property-read int|null $dhl_outbound_shipments_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \Acme\Dhl\Models\DhlShipment> $dhlReturnShipments
|
||||
* @property-read Collection<int, DhlShipment> $dhlReturnShipments
|
||||
* @property-read int|null $dhl_return_shipments_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \Acme\Dhl\Models\DhlShipment> $dhlShipments
|
||||
* @property-read Collection<int, DhlShipment> $dhlShipments
|
||||
* @property-read int|null $dhl_shipments_count
|
||||
*
|
||||
* @mixin \Eloquent
|
||||
|
|
@ -608,7 +613,7 @@ class ShoppingOrder extends Model
|
|||
*/
|
||||
public function isCancellationInvoice()
|
||||
{
|
||||
return \App\Models\UserInvoice::where('shopping_order_id', $this->id)
|
||||
return UserInvoice::where('shopping_order_id', $this->id)
|
||||
->where('cancellation', true)
|
||||
->whereNull('cancellation_id')
|
||||
->exists();
|
||||
|
|
@ -620,7 +625,7 @@ class ShoppingOrder extends Model
|
|||
*/
|
||||
public function getCancellationInvoice()
|
||||
{
|
||||
return \App\Models\UserInvoice::where('shopping_order_id', $this->id)
|
||||
return UserInvoice::where('shopping_order_id', $this->id)
|
||||
->where('cancellation', true)
|
||||
->whereNull('cancellation_id')
|
||||
->first();
|
||||
|
|
@ -710,13 +715,13 @@ class ShoppingOrder extends Model
|
|||
}
|
||||
|
||||
foreach ($tax_split as $key => $value) {
|
||||
$tax_split[$key]['vk_tax'] = number_format($value['vk_tax'], 2);
|
||||
$tax_split[$key]['ek_tax'] = number_format($value['ek_tax'], 2);
|
||||
$tax_split[$key]['vk_tax'] = number_format($value['vk_tax'], 2, '.', '');
|
||||
$tax_split[$key]['ek_tax'] = number_format($value['ek_tax'], 2, '.', '');
|
||||
}
|
||||
|
||||
foreach ($net_split as $key => $value) {
|
||||
$net_split[$key]['vk_net'] = number_format($value['vk_net'], 2);
|
||||
$net_split[$key]['ek_net'] = number_format($value['ek_net'], 2);
|
||||
$net_split[$key]['vk_net'] = number_format($value['vk_net'], 2, '.', '');
|
||||
$net_split[$key]['ek_net'] = number_format($value['ek_net'], 2, '.', '');
|
||||
}
|
||||
}
|
||||
if (! isset($tax_split[16]) && ! isset($tax_split[19])) {
|
||||
|
|
@ -779,10 +784,10 @@ class ShoppingOrder extends Model
|
|||
}
|
||||
|
||||
foreach ($tax_split as $key => $value) {
|
||||
$tax_split[$key] = number_format($value, 2);
|
||||
$tax_split[$key] = number_format($value, 2, '.', '');
|
||||
}
|
||||
foreach ($net_split as $key => $value) {
|
||||
$net_split[$key] = number_format($value, 2);
|
||||
$net_split[$key] = number_format($value, 2, '.', '');
|
||||
}
|
||||
}
|
||||
$this->tax_split = $tax_split;
|
||||
|
|
@ -798,7 +803,7 @@ class ShoppingOrder extends Model
|
|||
$fullname = $this->shopping_user->getFullNameAsArray();
|
||||
$ret = '';
|
||||
$ret .= $fullname['company'] ? $fullname['company'].' | ' : '';
|
||||
$ret .= $fullname['salutation'] ? \App\Services\HTMLHelper::getSalutationLang($fullname['salutation']).' ' : '';
|
||||
$ret .= $fullname['salutation'] ? HTMLHelper::getSalutationLang($fullname['salutation']).' ' : '';
|
||||
$ret .= $fullname['firstname'] ? $fullname['firstname'].' ' : '';
|
||||
$ret .= $fullname['lastname'] ? $fullname['lastname'] : '';
|
||||
$ret .= $fullname['email'] ? ' | '.$fullname['email'].'' : '';
|
||||
|
|
|
|||
|
|
@ -91,6 +91,23 @@ class UserAbo extends Model
|
|||
|
||||
protected $table = 'user_abos';
|
||||
|
||||
/**
|
||||
* Ein gelöschtes Abo darf nicht aktiv bleiben: Softdelete setzt nur
|
||||
* deleted_at, wodurch active=1-Leichen entstehen, die Incentive-,
|
||||
* Statistik- und Ist/Soll-Zahlen auseinanderlaufen lassen. Deshalb wird
|
||||
* active beim Löschen immer mitgesetzt (gilt für Model-Deletes; Query-
|
||||
* Builder-Deletes lösen keine Model-Events aus).
|
||||
*/
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::deleting(function (UserAbo $abo): void {
|
||||
if ($abo->active) {
|
||||
$abo->active = false;
|
||||
$abo->saveQuietly();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected $casts = [
|
||||
'user_id' => 'int',
|
||||
'member_id' => 'int',
|
||||
|
|
@ -105,6 +122,8 @@ class UserAbo extends Model
|
|||
'next_date' => 'datetime',
|
||||
'onetime_reminder_sent_for' => 'date',
|
||||
'cancel_date' => 'datetime',
|
||||
'last_pause_date' => 'date',
|
||||
'pause_count' => 'int',
|
||||
'user_deleted_at' => 'datetime',
|
||||
'carddata' => 'array',
|
||||
'card_update_pending_at' => 'datetime',
|
||||
|
|
@ -133,6 +152,8 @@ class UserAbo extends Model
|
|||
'next_date',
|
||||
'onetime_reminder_sent_for',
|
||||
'cancel_date',
|
||||
'last_pause_date',
|
||||
'pause_count',
|
||||
'user_deleted_at',
|
||||
'card_update_pending_at',
|
||||
];
|
||||
|
|
@ -355,6 +376,11 @@ class UserAbo extends Model
|
|||
return $this->hasMany(UserAboItem::class);
|
||||
}
|
||||
|
||||
public function status_histories()
|
||||
{
|
||||
return $this->hasMany(UserAboStatusHistory::class);
|
||||
}
|
||||
|
||||
public function one_time_items()
|
||||
{
|
||||
return $this->hasMany(UserAboOneTimeItem::class);
|
||||
|
|
|
|||
127
app/Models/UserAboStatusHistory.php
Normal file
127
app/Models/UserAboStatusHistory.php
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* Protokoll der Status-Aktionen eines Abos (Pause, Kündigung, Reaktivierung):
|
||||
* wer (view + actor_user_id) hat wann welche Aktion ausgeführt und wie sich das
|
||||
* Ausführungsdatum dadurch verschoben hat.
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_abo_id
|
||||
* @property string $action
|
||||
* @property string|null $view
|
||||
* @property int|null $actor_user_id
|
||||
* @property Carbon|null $previous_next_date
|
||||
* @property Carbon|null $new_next_date
|
||||
*/
|
||||
class UserAboStatusHistory extends Model
|
||||
{
|
||||
public const ACTION_PAUSED = 'paused';
|
||||
|
||||
public const ACTION_CANCELLED = 'cancelled';
|
||||
|
||||
public const ACTION_DEACTIVATED = 'deactivated';
|
||||
|
||||
public const ACTION_REACTIVATED = 'reactivated';
|
||||
|
||||
public static $actionLabels = [
|
||||
self::ACTION_PAUSED => 'abo_history.status_paused',
|
||||
self::ACTION_CANCELLED => 'abo_history.status_cancelled',
|
||||
self::ACTION_DEACTIVATED => 'abo_history.status_deactivated',
|
||||
self::ACTION_REACTIVATED => 'abo_history.status_reactivated',
|
||||
];
|
||||
|
||||
public static $actionColors = [
|
||||
self::ACTION_PAUSED => 'warning',
|
||||
self::ACTION_CANCELLED => 'danger',
|
||||
self::ACTION_DEACTIVATED => 'secondary',
|
||||
self::ACTION_REACTIVATED => 'success',
|
||||
];
|
||||
|
||||
/**
|
||||
* Formular-View → Kanal-Label/Farbe der Item-Historie (gleiche Optik im Protokoll).
|
||||
*/
|
||||
public static $viewChannelMap = [
|
||||
'me' => 'user_me',
|
||||
'ot' => 'user_ot',
|
||||
'portal' => 'portal',
|
||||
'admin' => 'admin',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'user_abo_id',
|
||||
'action',
|
||||
'view',
|
||||
'actor_user_id',
|
||||
'previous_next_date',
|
||||
'new_next_date',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'user_abo_id' => 'int',
|
||||
'actor_user_id' => 'int',
|
||||
'previous_next_date' => 'date',
|
||||
'new_next_date' => 'date',
|
||||
];
|
||||
|
||||
public function user_abo(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(UserAbo::class);
|
||||
}
|
||||
|
||||
public function actor(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'actor_user_id');
|
||||
}
|
||||
|
||||
public function getActionBadge(): string
|
||||
{
|
||||
$label = isset(self::$actionLabels[$this->action]) ? __(self::$actionLabels[$this->action]) : $this->action;
|
||||
$color = self::$actionColors[$this->action] ?? 'secondary';
|
||||
|
||||
return '<span class="badge badge-'.$color.'">'.$label.'</span>';
|
||||
}
|
||||
|
||||
public function getChannelBadge(): string
|
||||
{
|
||||
$channel = self::$viewChannelMap[$this->view] ?? 'system';
|
||||
$label = isset(UserAboItemHistory::$channelLabels[$channel]) ? __(UserAboItemHistory::$channelLabels[$channel]) : $channel;
|
||||
$color = UserAboItemHistory::$channelColors[$channel] ?? 'secondary';
|
||||
|
||||
return '<span class="badge badge-outline-'.$color.'">'.$label.'</span>';
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
if ($this->action === self::ACTION_PAUSED && $this->previous_next_date && $this->new_next_date) {
|
||||
return __('abo_history.status_shift', [
|
||||
'from' => $this->previous_next_date->format(\Util::formatDateDB()),
|
||||
'to' => $this->new_next_date->format(\Util::formatDateDB()),
|
||||
]);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getFormattedDate(): string
|
||||
{
|
||||
return $this->created_at ? $this->created_at->format(\Util::formatDateDB().' H:i') : '';
|
||||
}
|
||||
|
||||
public function getActorName(): string
|
||||
{
|
||||
if (! $this->actor) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$name = trim(($this->actor->account?->first_name ?? '').' '.($this->actor->account?->last_name ?? ''));
|
||||
|
||||
return $name !== '' ? $name : ($this->actor->email ?? '-');
|
||||
}
|
||||
}
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Http\Controllers\Api\KasController;
|
||||
use App\Http\Controllers\Api\KasSLLController;
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use Cviebrock\EloquentSluggable\Sluggable;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
|
|
@ -32,9 +32,10 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\UserShopOnSite[] $on_sites
|
||||
* @property-read Collection|UserShopOnSite[] $on_sites
|
||||
* @property-read int|null $on_sites_count
|
||||
* @property-read \App\User $user
|
||||
* @property-read User $user
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserShop findSimilarSlugs($attribute, $config, $slug)
|
||||
* @method static bool|null forceDelete()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserShop newModelQuery()
|
||||
|
|
@ -65,16 +66,16 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserShop withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserShop withoutTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
|
||||
*
|
||||
* @property array|null $trans
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereTrans($value)
|
||||
*
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserShop extends Model
|
||||
{
|
||||
protected $table = 'user_shops';
|
||||
private $is_online = NULL;
|
||||
private $ssl_certificate_sni = NULL;
|
||||
private $ssl_certificate_sni_is_active = NULL;
|
||||
|
||||
protected $casts = [
|
||||
'featured' => 'array',
|
||||
|
|
@ -86,15 +87,17 @@ class UserShop extends Model
|
|||
];
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
use Sluggable;
|
||||
|
||||
public function sluggable() : array
|
||||
|
||||
public function sluggable(): array
|
||||
{
|
||||
return [
|
||||
'slug' => [
|
||||
'source' => 'name'
|
||||
]
|
||||
'source' => 'name',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -103,18 +106,27 @@ class UserShop extends Model
|
|||
return $this->belongsTo('App\User', 'user_id');
|
||||
}
|
||||
|
||||
public function on_sites(){
|
||||
public function on_sites()
|
||||
{
|
||||
return $this->hasMany('App\Models\UserShopOnSite', 'user_shop_id', 'id');
|
||||
}
|
||||
|
||||
public function getActiveDateFormat(){
|
||||
if(!$this->attributes['active_date']){ return ""; }
|
||||
public function getActiveDateFormat()
|
||||
{
|
||||
if (! $this->attributes['active_date']) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return Carbon::parse($this->attributes['active_date'])->format(\Util::formatDateTimeDB());
|
||||
}
|
||||
|
||||
public function getActiveDateFormatSmall(){
|
||||
if(!$this->attributes['active_date']){ return ""; }
|
||||
return Carbon::parse($this->attributes['active_date'])->format("d.m.Y");
|
||||
public function getActiveDateFormatSmall()
|
||||
{
|
||||
if (! $this->attributes['active_date']) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return Carbon::parse($this->attributes['active_date'])->format('d.m.Y');
|
||||
}
|
||||
|
||||
public function getLang($key, $default = true)
|
||||
|
|
@ -123,6 +135,7 @@ class UserShop extends Model
|
|||
if ($lang == 'de') {
|
||||
return $this->{$key};
|
||||
}
|
||||
|
||||
return $this->getTrans($key, $lang, $default);
|
||||
}
|
||||
|
||||
|
|
@ -131,126 +144,70 @@ class UserShop extends Model
|
|||
if ($lang == 'de') {
|
||||
return $this->{$key};
|
||||
}
|
||||
if(!empty($this->trans[$lang][$key])){
|
||||
if (! empty($this->trans[$lang][$key])) {
|
||||
return $this->trans[$lang][$key];
|
||||
}
|
||||
if($default){
|
||||
return !empty($this->{$key}) ? $this->{$key} : '';
|
||||
if ($default) {
|
||||
return ! empty($this->{$key}) ? $this->{$key} : '';
|
||||
}
|
||||
return "";
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getSubdomain($session=true)
|
||||
public function getSubdomain($session = true)
|
||||
{
|
||||
if($session && \Session::has('user_shop_domain')){
|
||||
if ($session && \Session::has('user_shop_domain')) {
|
||||
return \Session::get('user_shop_domain');
|
||||
}
|
||||
return config('app.protocol').$this->attributes['slug'].".".config('app.domain').config('app.tld_care');
|
||||
|
||||
return config('app.protocol').$this->attributes['slug'].'.'.config('app.domain').config('app.tld_care');
|
||||
}
|
||||
|
||||
public function getSubdomainStatus()
|
||||
public function getSubdomainAvailable()
|
||||
{
|
||||
if($this->is_online !== NULL){
|
||||
return $this->is_online;
|
||||
}
|
||||
$rCurlHandle = curl_init($this->attributes['slug'].'.mivita.care');
|
||||
|
||||
$kas = new KasController();
|
||||
$domain = 'mivita.care';
|
||||
$pra = array(
|
||||
'subdomain_name' => $this->attributes['slug'].".".$domain,
|
||||
'domain_name' => $domain,
|
||||
);
|
||||
curl_setopt($rCurlHandle, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($rCurlHandle, CURLOPT_HEADER, true);
|
||||
curl_setopt($rCurlHandle, CURLOPT_NOBODY, true);
|
||||
curl_setopt($rCurlHandle, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
//check if exisist
|
||||
$subdomain = $kas->action('get_subdomains', $pra);
|
||||
if(is_soap_fault($subdomain)){
|
||||
$strResponse = curl_exec($rCurlHandle);
|
||||
|
||||
curl_close($rCurlHandle);
|
||||
|
||||
if (! $strResponse) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(!empty($subdomain[0]['is_active']) && $subdomain[0]['is_active'] == 'Y'){
|
||||
$this->is_online = true;
|
||||
}else{
|
||||
$this->is_online = false;
|
||||
}
|
||||
|
||||
if(!empty($subdomain[0]['ssl_certificate_sni']) && $subdomain[0]['ssl_certificate_sni'] == 'Y'){
|
||||
$this->ssl_certificate_sni = true;
|
||||
}else{
|
||||
$this->ssl_certificate_sni = false;
|
||||
$this->userShopAddSSL($subdomain[0]['subdomain_name']);
|
||||
}
|
||||
|
||||
if(!empty($subdomain[0]['ssl_certificate_sni_is_active']) && $subdomain[0]['ssl_certificate_sni_is_active'] == 'j'){
|
||||
$this->ssl_certificate_sni_is_active = true;
|
||||
}else{
|
||||
$this->ssl_certificate_sni_is_active = false;
|
||||
}
|
||||
|
||||
return $this->is_online;
|
||||
}
|
||||
|
||||
public function userShopAddSSL($full_subdomain_name)
|
||||
{
|
||||
$kas = new KasController();
|
||||
$ssl = KasSLLController::getApiSSLParameter();
|
||||
$pra = array(
|
||||
'hostname' => $full_subdomain_name
|
||||
);
|
||||
$pra = array_merge($pra, $ssl);
|
||||
$value = $kas->action('update_ssl', $pra);
|
||||
return $value;
|
||||
}
|
||||
public function getSubdomainSslSin ()
|
||||
{
|
||||
return $this->ssl_certificate_sni;
|
||||
}
|
||||
public function getSubdomainSslSinActive ()
|
||||
{
|
||||
return $this->ssl_certificate_sni_is_active;
|
||||
}
|
||||
public function getSubdomainAvailable ()
|
||||
{
|
||||
$rCurlHandle = curl_init ( $this->attributes['slug'].".mivita.care" );
|
||||
|
||||
curl_setopt ( $rCurlHandle, CURLOPT_CONNECTTIMEOUT, 10 );
|
||||
curl_setopt ( $rCurlHandle, CURLOPT_HEADER, TRUE );
|
||||
curl_setopt ( $rCurlHandle, CURLOPT_NOBODY, TRUE );
|
||||
curl_setopt ( $rCurlHandle, CURLOPT_RETURNTRANSFER, TRUE );
|
||||
|
||||
$strResponse = curl_exec ( $rCurlHandle );
|
||||
|
||||
curl_close ( $rCurlHandle );
|
||||
|
||||
if ( !$strResponse )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$url = "http://".$this->attributes['slug'].".mivita.care/domain/check";
|
||||
if(@file_get_contents($url) != 'checked'){
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function isImage(){
|
||||
if(empty($this->attributes['filename']) || @$this->attributes['filename'] == null || @$this->attributes['filename'] == ""){
|
||||
return false;
|
||||
}
|
||||
if(!\Storage::disk('public')->has('images/shop/'.$this->filename)){
|
||||
$url = 'http://'.$this->attributes['slug'].'.mivita.care/domain/check';
|
||||
if (@file_get_contents($url) != 'checked') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getImage(){
|
||||
if($this->isImage()){
|
||||
public function isImage()
|
||||
{
|
||||
if (empty($this->attributes['filename']) || @$this->attributes['filename'] == null || @$this->attributes['filename'] == '') {
|
||||
return false;
|
||||
}
|
||||
if (! \Storage::disk('public')->has('images/shop/'.$this->filename)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getImage()
|
||||
{
|
||||
if ($this->isImage()) {
|
||||
$link = 'images/shop/'.$this->filename;
|
||||
|
||||
return '/storage/'.$link.'?=lm='.\Storage::disk('public')->lastModified($link);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue