User Order step1

This commit is contained in:
Kevin Adametz 2020-08-07 16:02:03 +02:00
parent eb55b01b0d
commit a5db985ae8
90 changed files with 6439 additions and 421 deletions

View file

@ -2,6 +2,7 @@
namespace App;
use App\Models\PaymentMethod;
use Carbon\Carbon;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
@ -112,6 +113,8 @@ use Laravel\Passport\HasApiTokens;
* @property-read int|null $clients_count
* @property-read \Illuminate\Database\Eloquent\Collection|\Laravel\Passport\Token[] $tokens
* @property-read int|null $tokens_count
* @property array|null $payment_methods
* @method static \Illuminate\Database\Eloquent\Builder|\App\User wherePaymentMethods($value)
*/
class User extends Authenticatable
{
@ -134,6 +137,7 @@ class User extends Authenticatable
protected $casts = [
'settings' => 'array',
'payment_methods' => 'array'
];
/**
@ -366,7 +370,6 @@ class User extends Authenticatable
if(!$this->attributes['payment_account']){ return ""; }
if(!$time){
return Carbon::parse($this->attributes['payment_account'])->format(\Util::formatDateDB());
}
return Carbon::parse($this->attributes['payment_account'])->format(\Util::formatDateTimeDB());
}
@ -403,6 +406,18 @@ class User extends Authenticatable
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." | ";
}
}
$ret = rtrim($ret, " | ");
}
return $ret;
}
/**
* @return string
*/