April 2026 waren Wirtschaft Feedback

This commit is contained in:
Kevin Adametz 2026-04-10 17:14:38 +02:00
parent 02f2a4c23e
commit 9ce711d6b2
167 changed files with 25278 additions and 8518 deletions

View file

@ -3,23 +3,39 @@
namespace App;
use App\Mail\MailResetPassword;
use App\Models\File;
use App\Models\LeadType;
use App\Models\PaymentMethod;
use App\Models\UserAccount;
use App\Models\UserHistory;
use App\Models\UserLevel;
use App\Models\UserPayCredit;
use App\Models\UserShop;
use App\Models\UserUpdateEmail;
use App\Models\UserWhitelabelProduct;
use Carbon\Carbon;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\DatabaseNotification;
use Illuminate\Notifications\DatabaseNotificationCollection;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Mail;
use Laravel\Passport\Client;
use Laravel\Passport\HasApiTokens;
use Laravel\Passport\Token;
use Util;
/**
* App\User
*
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications
* @property-read DatabaseNotificationCollection|DatabaseNotification[] $notifications
* @property-read int|null $notifications_count
*
* @method static \Illuminate\Database\Eloquent\Builder|User newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|User newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|User query()
*
* @property int $id
* @property string $email
* @property \Illuminate\Support\Carbon|null $email_verified_at
@ -52,6 +68,7 @@ use Util;
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property string|null $deleted_at
*
* @method static \Illuminate\Database\Eloquent\Builder|User whereAboOptions($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereAccountId($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereAccountPayment($value)
@ -84,37 +101,44 @@ use Util;
* @method static \Illuminate\Database\Eloquent\Builder|User whereTestMode($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereWizard($value)
* @property-read \App\Models\UserAccount|null $account
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\File[] $files
*
* @property-read UserAccount|null $account
* @property-read Collection|File[] $files
* @property-read int|null $files_count
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\UserHistory[] $user_histories
* @property-read Collection|UserHistory[] $user_histories
* @property-read int|null $user_histories_count
* @property-read \App\Models\UserLevel|null $user_level
* @property-read UserLevel|null $user_level
* @property-read User|null $user_sponsor
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\UserUpdateEmail[] $user_update_email
* @property-read Collection|UserUpdateEmail[] $user_update_email
* @property-read int|null $user_update_email_count
* @property string|null $payment_account
* @property-read \App\Models\UserLevel|null $next_user_level
* @property-read UserLevel|null $next_user_level
*
* @method static \Illuminate\Database\Eloquent\Builder|User wherePaymentAccount($value)
*
* @property string|null $payment_credit
*
* @method static \Illuminate\Database\Eloquent\Builder|User wherePaymentCredit($value)
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\UserPayCredit[] $user_pay_credits
*
* @property-read Collection|UserPayCredit[] $user_pay_credits
* @property-read int|null $user_pay_credits_count
* @property-read \Illuminate\Database\Eloquent\Collection|\Laravel\Passport\Client[] $clients
* @property-read Collection|Client[] $clients
* @property-read int|null $clients_count
* @property-read \Illuminate\Database\Eloquent\Collection|\Laravel\Passport\Token[] $tokens
* @property-read Collection|Token[] $tokens
* @property-read int|null $tokens_count
* @property-read \App\Models\UserShop|null $shop
* @property-read UserShop|null $shop
* @property int|null $lead_type_id
* @property-read \App\Models\LeadType|null $lead_type
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\UserWhitelabelProduct> $whitelabel_products
* @property-read LeadType|null $lead_type
* @property-read Collection<int, UserWhitelabelProduct> $whitelabel_products
* @property-read int|null $whitelabel_products_count
*
* @method static \Illuminate\Database\Eloquent\Builder|User whereLeadTypeId($value)
*
* @mixin \Eloquent
*/
class User extends Authenticatable
{
use Notifiable, HasApiTokens;
use HasApiTokens, Notifiable;
/**
* The attributes that are mass assignable.
@ -142,13 +166,15 @@ class User extends Authenticatable
protected $casts = [
'email_verified_at' => 'datetime',
'settings' => 'array',
'payment_methods' => 'array'
'payment_methods' => 'array',
];
private $userImage = false;
private $userImageLink = false;
public function account(){
public function account()
{
return $this->belongsTo('App\Models\UserAccount', 'account_id');
}
@ -157,33 +183,42 @@ class User extends Authenticatable
return $this->hasOne('App\Models\UserShop', 'user_id', 'id');
}
public function user_level(){
public function user_level()
{
return $this->belongsTo('App\Models\UserLevel', 'm_level');
}
public function next_user_level(){
public function next_user_level()
{
return $this->belongsTo('App\Models\UserLevel', 'next_m_level');
}
public function user_sponsor(){
public function user_sponsor()
{
return $this->belongsTo('App\User', 'm_sponsor');
}
public function lead_type(){
public function lead_type()
{
return $this->belongsTo('App\Models\LeadType', 'lead_type_id');
}
public function sponsorHasCommisson(){
if($this->user_sponsor && $this->user_sponsor->user_level && $this->user_sponsor->user_level->partner_provision){
public function sponsorHasCommisson()
{
if ($this->user_sponsor && $this->user_sponsor->user_level && $this->user_sponsor->user_level->partner_provision) {
return true;
}
return false;
}
public function files(){
public function files()
{
return $this->hasMany('App\Models\File', 'user_id', '');
}
public function user_histories(){
public function user_histories()
{
return $this->hasMany('App\Models\UserHistory', 'user_id', '');
}
@ -201,62 +236,67 @@ class User extends Authenticatable
{
return $this->hasMany('App\Models\UserWhitelabelProduct', 'user_id', 'id');
}
public function getMUserSponsor(){
if($this->user_sponsor && $this->user_sponsor->account){
return $this->user_sponsor->account->first_name." ".$this->user_sponsor->account->last_name." | ".$this->user_sponsor->email;
public function getMUserSponsor()
{
if ($this->user_sponsor && $this->user_sponsor->account) {
return $this->user_sponsor->account->first_name.' '.$this->user_sponsor->account->last_name.' | '.$this->user_sponsor->email;
}
}
public function getFullName($email=true){
$ret = "";
if($this->account){
$ret = $this->account->first_name." ".$this->account->last_name;
public function getFullName($email = true)
{
$ret = '';
if ($this->account) {
$ret = $this->account->first_name.' '.$this->account->last_name;
}
if($email && $this->id > 1){
$ret .= " | ".$this->email;
if ($email && $this->id > 1) {
$ret .= ' | '.$this->email;
}
return $ret;
}
public function getFullAddress($email=true){
$ret = "";
if($this->account){
$ret .= $this->account->first_name." ".$this->account->last_name."\n";
public function getFullAddress($email = true)
{
$ret = '';
if ($this->account) {
$ret .= $this->account->first_name.' '.$this->account->last_name."\n";
$ret .= $this->account->address."\n";
$ret .= $this->account->address_2 ? $this->account->address_2."\n" : "";
$ret .= $this->account->zipcode." ".$this->account->city."\n";
$ret .= $email ? $this->email."\n" : "";
$ret .= $this->account->address_2 ? $this->account->address_2."\n" : '';
$ret .= $this->account->zipcode.' '.$this->account->city."\n";
$ret .= $email ? $this->email."\n" : '';
$pre = $this->account->pre_phone_id != "" ? $this->account->pre_phone->phone." " : "";
$ret .= $this->account->phone ? $pre.$this->account->phone."\n" : "";
$pre = $this->account->pre_mobil_id != "" ? $this->account->pre_mobil->phone." " : "";
$ret .= $this->account->mobil ? $pre.$this->account->mobil."\n" : "";
$pre = $this->account->pre_phone_id != '' ? $this->account->pre_phone->phone.' ' : '';
$ret .= $this->account->phone ? $pre.$this->account->phone."\n" : '';
$pre = $this->account->pre_mobil_id != '' ? $this->account->pre_mobil->phone.' ' : '';
$ret .= $this->account->mobil ? $pre.$this->account->mobil."\n" : '';
}
return $ret;
}
/**
/**
* @return bool
*/
public function isCopyReader()
{
if($this->admin >= 1){
if ($this->admin >= 1) {
return true;
}
return false;
}
/**
* @return bool
*/
public function isPasswort(){
if($this->password == env('APP_KEY')){
public function isPasswort(): bool
{
if (Hash::check(config('app.key'), $this->password)) {
return false;
}
return true;
}
@ -265,9 +305,10 @@ class User extends Authenticatable
*/
public function isAdmin()
{
if($this->admin >= 7){
if ($this->admin >= 7) {
return true;
}
return false;
}
@ -276,9 +317,10 @@ class User extends Authenticatable
*/
public function isSuperAdmin()
{
if($this->admin >= 8){
if ($this->admin >= 8) {
return true;
}
return false;
}
@ -287,9 +329,10 @@ class User extends Authenticatable
*/
public function isSySAdmin()
{
if($this->admin >= 9){
if ($this->admin >= 9) {
return true;
}
return false;
}
@ -298,9 +341,10 @@ class User extends Authenticatable
*/
public function isApiUser()
{
if($this->admin >= 10){
if ($this->admin >= 10) {
return true;
}
return false;
}
@ -312,195 +356,246 @@ class User extends Authenticatable
return $this->test_mode ? true : false;
}
/**
* @return bool
*/
public function showSideNav()
{
if($this->active == 1 && $this->blocked == 0 && $this->wizard >= 10){
if ($this->active == 1 && $this->blocked == 0 && $this->wizard >= 10) {
return true;
}
return false;
}
public function isActive(){
public function isActive()
{
return ($this->active == 1 && $this->blocked == 0) ? true : false;
}
public function isActiveAccount(){
if($this->isActive() && $this->payment_account){
public function isActiveAccount()
{
if ($this->isActive() && $this->payment_account) {
return Carbon::parse($this->payment_account)->gt(Carbon::now());
}
return false;
}
public function isRenewalAccount(){
public function isRenewalAccount()
{
if ($this->payment_account) {
return Carbon::parse($this->payment_account)->modify('-'.(config('main.renewal_days')).' days')->lt(Carbon::now());
}
return false;
}
public function nextRenewalAccount(){
return $this->payment_account ? Carbon::parse($this->payment_account)->modify('-'.config('main.renewal_days').' days')->format(\Util::formatDateTimeDB()) : false ;
public function nextRenewalAccount()
{
return $this->payment_account ? Carbon::parse($this->payment_account)->modify('-'.config('main.renewal_days').' days')->format(Util::formatDateTimeDB()) : false;
}
public function daysActiveAccount(){
public function daysActiveAccount()
{
return Carbon::now()->diffInDays(Carbon::parse($this->payment_account), false);
}
public function modifyActiveAccount($add = "1 year"){
return Carbon::parse($this->payment_account)->modify($add)->format(\Util::formatDateTimeDB());
public function modifyActiveAccount($add = '1 year')
{
return Carbon::parse($this->payment_account)->modify($add)->format(Util::formatDateTimeDB());
}
public function daysHumansActiveAccount(){
public function daysHumansActiveAccount()
{
return Carbon::now()->diffForHumans(Carbon::parse($this->payment_account));
}
public function daysActiveShop(){
public function daysActiveShop()
{
return Carbon::now()->diffInDays(Carbon::parse($this->payment_shop), false);
}
public function modifyActiveShop($add = "1 year"){
return Carbon::parse($this->payment_shop)->modify($add)->format(\Util::formatDateTimeDB());
public function modifyActiveShop($add = '1 year')
{
return Carbon::parse($this->payment_shop)->modify($add)->format(Util::formatDateTimeDB());
}
public function daysHumansActiveShop(){
public function daysHumansActiveShop()
{
return Carbon::now()->diffForHumans(Carbon::parse($this->payment_shop));
}
public function isAboOption(){
public function isAboOption()
{
return false;
}
/**
* @return string
*/
public function getConfirmationDateFormat(){
if(!$this->attributes['confirmation_date']){ return ""; }
return Carbon::parse($this->attributes['confirmation_date'])->format(\Util::formatDateTimeDB());
public function getConfirmationDateFormat()
{
if (! $this->attributes['confirmation_date']) {
return '';
}
return Carbon::parse($this->attributes['confirmation_date'])->format(Util::formatDateTimeDB());
}
/**
* @return string
*/
public function getActiveDateFormat(){
if(!$this->attributes['active_date']){ return ""; }
return Carbon::parse($this->attributes['active_date'])->format(\Util::formatDateTimeDB());
public function getActiveDateFormat()
{
if (! $this->attributes['active_date']) {
return '';
}
return Carbon::parse($this->attributes['active_date'])->format(Util::formatDateTimeDB());
}
/**
* @return string
*/
public function getAgreementFormat(){
if(!$this->attributes['agreement']){ return ""; }
return Carbon::parse($this->attributes['agreement'])->format(\Util::formatDateTimeDB());
public function getAgreementFormat()
{
if (! $this->attributes['agreement']) {
return '';
}
return Carbon::parse($this->attributes['agreement'])->format(Util::formatDateTimeDB());
}
public function getPaymentAccountDateFormat($time = true){
if(!$this->attributes['payment_account']){ return ""; }
if(!$time){
return Carbon::parse($this->attributes['payment_account'])->format(\Util::formatDateDB());
public function getPaymentAccountDateFormat($time = true)
{
if (! $this->attributes['payment_account']) {
return '';
}
return Carbon::parse($this->attributes['payment_account'])->format(\Util::formatDateTimeDB());
if (! $time) {
return Carbon::parse($this->attributes['payment_account'])->format(Util::formatDateDB());
}
return Carbon::parse($this->attributes['payment_account'])->format(Util::formatDateTimeDB());
}
public function getPaymentShopDateFormat($time = true){
if(!$this->attributes['payment_shop']){ return ""; }
if(!$time){
return Carbon::parse($this->attributes['payment_shop'])->format(\Util::formatDateDB());
public function getPaymentShopDateFormat($time = true)
{
if (! $this->attributes['payment_shop']) {
return '';
}
return Carbon::parse($this->attributes['payment_shop'])->format(\Util::formatDateTimeDB());
if (! $time) {
return Carbon::parse($this->attributes['payment_shop'])->format(Util::formatDateDB());
}
return Carbon::parse($this->attributes['payment_shop'])->format(Util::formatDateTimeDB());
}
public function getReleaseAccountFormat($time = true){
if(!$this->attributes['release_account']){ return ""; }
if(!$time){
return Carbon::parse($this->attributes['release_account'])->format(\Util::formatDateDB());
public function getReleaseAccountFormat($time = true)
{
if (! $this->attributes['release_account']) {
return '';
}
return Carbon::parse($this->attributes['release_account'])->format(\Util::formatDateTimeDB());
if (! $time) {
return Carbon::parse($this->attributes['release_account'])->format(Util::formatDateDB());
}
return Carbon::parse($this->attributes['release_account'])->format(Util::formatDateTimeDB());
}
public function getFormattedPaymentCredit()
{
return isset($this->attributes['payment_credit']) ? Util::formatNumber($this->attributes['payment_credit']) : "0";
return isset($this->attributes['payment_credit']) ? Util::formatNumber($this->attributes['payment_credit']) : '0';
}
public function setSetting(array $revisions, bool $save = true){
if(!$this->settings){
public function setSetting(array $revisions, bool $save = true)
{
if (! $this->settings) {
$this->settings = [];
}
$this->settings = array_merge($this->settings, $revisions);
if ($save) {
$this->save();
}
return $this;
}
public function getSetting($key, $default = null){
public function getSetting($key, $default = null)
{
return isset($this->settings[$key]) ? $this->settings[$key] : $default;
}
public function getPaymentMethodsShort(){
$ret = "";
if($this->payment_methods !== null){
foreach ($this->payment_methods as $payment_method){
if($find = PaymentMethod::find($payment_method)){
$ret .= $find->short." | ";
public function getPaymentMethodsShort()
{
$ret = '';
if ($this->payment_methods !== null) {
foreach ($this->payment_methods as $payment_method) {
if ($find = PaymentMethod::find($payment_method)) {
$ret .= $find->short.' | ';
}
}
$ret = rtrim($ret, " | ");
$ret = rtrim($ret, ' | ');
}
return $ret;
}
/**
* @return string
*/
public function getLandByCountry(){
if($this->account && $this->account->country_id){
public function getLandByCountry()
{
if ($this->account && $this->account->country_id) {
$code = $this->account->country->code;
if($code == "FR"){
if ($code == 'FR') {
return 'fr';
}
if($code == "CH"){
if ($code == 'CH') {
return 'de';
}
if($code == "NL"){
if ($code == 'NL') {
return 'nl';
}
if($code == "DE"){
if ($code == 'DE') {
return 'de';
}
}
return "de";
return 'de';
}
public function getBirthdayFormat($format = "d.m.Y"){
if($this->account && $this->account->getBirthdayRaw()){
public function getBirthdayFormat($format = 'd.m.Y')
{
if ($this->account && $this->account->getBirthdayRaw()) {
return (int) Carbon::parse($this->account->getBirthdayRaw())->format($format);
}
return null;
}
public function hasProfileImage(){
public function hasProfileImage()
{
if($this->userImage){
if ($this->userImage) {
return $this->userImage;
}
if(\Storage::disk('user')->has($this->id.'/avatar.jpg')){
if (\Storage::disk('user')->has($this->id.'/avatar.jpg')) {
$this->userImage = $this->id.'/avatar.jpg';
}
if(\Storage::disk('user')->has($this->id.'/avatar.png')){
if (\Storage::disk('user')->has($this->id.'/avatar.png')) {
$this->userImage = $this->id.'/avatar.png';
}
return $this->userImage;
}
public function getProfileImage(){
if($this->hasProfileImage()){
public function getProfileImage()
{
if ($this->hasProfileImage()) {
return str_replace('/', '_', $this->userImage);
}
return null;
}