20-02-2026
This commit is contained in:
parent
a8b395e20d
commit
a00c42e770
252 changed files with 28785 additions and 8907 deletions
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Carbon\Carbon;
|
||||
|
||||
|
||||
/**
|
||||
* App\Models\UserAccount
|
||||
|
|
@ -18,6 +17,7 @@ use Carbon\Carbon;
|
|||
* @property-read \App\Models\Country $pre_mobil
|
||||
* @property-read \App\Models\Country $pre_phone
|
||||
* @property-read \App\User $user
|
||||
*
|
||||
* @method static bool|null forceDelete()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount newQuery()
|
||||
|
|
@ -26,6 +26,7 @@ use Carbon\Carbon;
|
|||
* @method static bool|null restore()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserAccount withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserAccount withoutTrashed()
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $salutation
|
||||
* @property string|null $first_name
|
||||
|
|
@ -63,6 +64,7 @@ use Carbon\Carbon;
|
|||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||
* @property-read \App\Models\Country $shipping_country
|
||||
* @property-read \App\Models\Country|null $shipping_pre_phone
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereAddress($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereAddress2($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereBirthday($value)
|
||||
|
|
@ -100,41 +102,53 @@ use Carbon\Carbon;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereWebsite($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereZipcode($value)
|
||||
*
|
||||
* @property string|null $m_account
|
||||
* @property string|null $m_salutation
|
||||
* @property string|null $m_first_name
|
||||
* @property string|null $m_last_name
|
||||
* @property string|null $m_notes
|
||||
* @property int|null $taxable_sales
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereMAccount($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereMFirstName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereMLastName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereMNotes($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereMSalutation($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereTaxableSales($value)
|
||||
*
|
||||
* @property array|null $payment_data
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount wherePaymentData($value)
|
||||
*
|
||||
* @property string|null $accepted_contract
|
||||
* @property array|null $notice
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereAcceptedContract($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereNotice($value)
|
||||
*
|
||||
* @property int $reverse_charge
|
||||
* @property string|null $reverse_charge_code
|
||||
* @property string|null $reverse_charge_valid
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereReverseCharge($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereReverseChargeCode($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereReverseChargeValid($value)
|
||||
*
|
||||
* @property string|null $bank_owner
|
||||
* @property string|null $bank_iban
|
||||
* @property string|null $bank_bic
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereBankBic($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereBankIban($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereBankOwner($value)
|
||||
*
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserAccount extends Model
|
||||
{
|
||||
protected $table = 'user_accounts';
|
||||
|
||||
protected $fillable = [
|
||||
'm_account',
|
||||
'm_salutation',
|
||||
|
|
@ -178,19 +192,20 @@ class UserAccount extends Model
|
|||
'bank_owner',
|
||||
'bank_iban',
|
||||
'bank_bic',
|
||||
'notice'
|
||||
'notice',
|
||||
'language',
|
||||
];
|
||||
//'reverse_charge', 'reverse_charge_valid'
|
||||
// 'reverse_charge', 'reverse_charge_valid'
|
||||
|
||||
protected $casts = [
|
||||
'payment_data' => 'array',
|
||||
'notice' => 'array',
|
||||
//'reverse_charge' => 'bool'
|
||||
// 'reverse_charge' => 'bool'
|
||||
];
|
||||
|
||||
use SoftDeletes;
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
public function user()
|
||||
{
|
||||
|
|
@ -224,38 +239,42 @@ class UserAccount extends Model
|
|||
|
||||
public function getBirthdayAttribute($value)
|
||||
{
|
||||
if (!$value) {
|
||||
return "";
|
||||
if (! $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return Carbon::parse($value)->format(\Util::formatDateDB());
|
||||
}
|
||||
|
||||
public function setBirthdayAttribute($value)
|
||||
{
|
||||
$this->attributes['birthday'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
$this->attributes['birthday'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : null;
|
||||
}
|
||||
|
||||
public function getDataProtectionFormat()
|
||||
{
|
||||
if (!$this->attributes['data_protection']) {
|
||||
return "";
|
||||
if (! $this->attributes['data_protection']) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return Carbon::parse($this->attributes['data_protection'])->format(\Util::formatDateTimeDB());
|
||||
}
|
||||
|
||||
public function getAcceptContractFormat()
|
||||
{
|
||||
if (!$this->attributes['accept_contract']) {
|
||||
return "";
|
||||
if (! $this->attributes['accept_contract']) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return Carbon::parse($this->attributes['accept_contract'])->format(\Util::formatDateTimeDB());
|
||||
}
|
||||
|
||||
public function getReverseChargeValidFormat()
|
||||
{
|
||||
if (!$this->attributes['reverse_charge_valid']) {
|
||||
return "";
|
||||
if (! $this->attributes['reverse_charge_valid']) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return Carbon::parse($this->attributes['reverse_charge_valid'])->format(\Util::formatDateTimeDB());
|
||||
}
|
||||
|
||||
|
|
@ -268,10 +287,12 @@ class UserAccount extends Model
|
|||
if ($as) {
|
||||
return $as;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public function setNotice($key, $value)
|
||||
|
|
@ -289,35 +310,77 @@ class UserAccount extends Model
|
|||
|
||||
public function getPhoneNumber()
|
||||
{
|
||||
if ($this->mobil && $this->mobil !== "") {
|
||||
return ($this->pre_mobil ? $this->pre_mobil->phone : '') . " " . $this->mobil;
|
||||
if ($this->mobil && $this->mobil !== '') {
|
||||
return ($this->pre_mobil ? $this->pre_mobil->phone : '').' '.$this->mobil;
|
||||
}
|
||||
if ($this->phone && $this->phone !== "") {
|
||||
return ($this->pre_phone ? $this->pre_phone->phone : '') . " " . $this->phone;
|
||||
if ($this->phone && $this->phone !== '') {
|
||||
return ($this->pre_phone ? $this->pre_phone->phone : '').' '.$this->phone;
|
||||
}
|
||||
}
|
||||
|
||||
public function getPhoneFull()
|
||||
{
|
||||
if ($this->phone && $this->phone !== "") {
|
||||
return ($this->pre_phone ? $this->pre_phone->phone : '') . " " . $this->phone;
|
||||
if ($this->phone && $this->phone !== '') {
|
||||
return ($this->pre_phone ? $this->pre_phone->phone : '').' '.$this->phone;
|
||||
}
|
||||
return "";
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getMobilFull()
|
||||
{
|
||||
if ($this->mobil && $this->mobil !== "") {
|
||||
return ($this->pre_mobil ? $this->pre_mobil->phone : '') . " " . $this->mobil;
|
||||
if ($this->mobil && $this->mobil !== '') {
|
||||
return ($this->pre_mobil ? $this->pre_mobil->phone : '').' '.$this->mobil;
|
||||
}
|
||||
return "";
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getShippingPhoneFull()
|
||||
{
|
||||
if ($this->shipping_phone && $this->shipping_phone !== "") {
|
||||
return ($this->shipping_pre_phone ? $this->shipping_pre_phone->phone : '') . " " . $this->shipping_phone;
|
||||
if ($this->shipping_phone && $this->shipping_phone !== '') {
|
||||
return ($this->shipping_pre_phone ? $this->shipping_pre_phone->phone : '').' '.$this->shipping_phone;
|
||||
}
|
||||
return "";
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor für das language Attribut.
|
||||
* Gibt die App-Locale zurück, wenn keine Sprache gesetzt ist.
|
||||
*
|
||||
* @param string|null $value
|
||||
* @return string Sprachcode (de, en, es)
|
||||
*/
|
||||
public function getLanguageAttribute($value): string
|
||||
{
|
||||
return $value ?: \App::getLocale();
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias für getLanguageAttribute - für Konsistenz mit anderen Models.
|
||||
*
|
||||
* @return string Sprachcode (de, en, es)
|
||||
*/
|
||||
public function getLocale(): string
|
||||
{
|
||||
return $this->language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert die verfügbaren Sprachen aus der Config als Array für Select-Felder.
|
||||
*
|
||||
* @return array ['code' => 'Native Name', ...]
|
||||
*/
|
||||
public static function getAvailableLanguages(): array
|
||||
{
|
||||
$locales = config('localization.supportedLocales', []);
|
||||
$languages = [];
|
||||
|
||||
foreach ($locales as $code => $locale) {
|
||||
$languages[$code] = $locale['native'] ?? $locale['name'] ?? $code;
|
||||
}
|
||||
|
||||
return $languages;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue