#10 Promotion Modul, Kommentar 2
This commit is contained in:
parent
f0da981737
commit
c9e1545693
128 changed files with 8194 additions and 637 deletions
47
app/User.php
47
app/User.php
|
|
@ -101,6 +101,10 @@ use Util;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|User wherePaymentCredit($value)
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\UserPayCredit[] $user_pay_credits
|
||||
* @property-read int|null $user_pay_credits_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Laravel\Passport\Client[] $clients
|
||||
* @property-read int|null $clients_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Laravel\Passport\Token[] $tokens
|
||||
* @property-read int|null $tokens_count
|
||||
*/
|
||||
class User extends Authenticatable
|
||||
{
|
||||
|
|
@ -135,6 +139,9 @@ class User extends Authenticatable
|
|||
'payment_methods' => 'array'
|
||||
];
|
||||
|
||||
private $userImage = false;
|
||||
private $userImageLink = false;
|
||||
|
||||
public function account(){
|
||||
return $this->belongsTo('App\Models\UserAccount', 'account_id');
|
||||
}
|
||||
|
|
@ -194,6 +201,25 @@ class User extends Authenticatable
|
|||
return $ret;
|
||||
}
|
||||
|
||||
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" : "";
|
||||
|
||||
$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
|
||||
*/
|
||||
|
|
@ -414,6 +440,27 @@ class User extends Authenticatable
|
|||
return null;
|
||||
}
|
||||
|
||||
public function hasProfileImage(){
|
||||
|
||||
if($this->userImage){
|
||||
return $this->userImage;
|
||||
}
|
||||
if(\Storage::disk('user')->has($this->id.'/avatar.jpg')){
|
||||
$this->userImage = $this->id.'/avatar.jpg';
|
||||
}
|
||||
if(\Storage::disk('user')->has($this->id.'/avatar.png')){
|
||||
$this->userImage = $this->id.'/avatar.jpg';
|
||||
}
|
||||
return $this->userImage;
|
||||
}
|
||||
|
||||
public function getProfileImage(){
|
||||
if($this->hasProfileImage()){
|
||||
return str_replace('/', '_', $this->userImage);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the password reset notification.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue