Updates to 03-2025

This commit is contained in:
Kevin Adametz 2025-04-01 10:39:21 +02:00
parent 6167273a48
commit 9b54eb0512
348 changed files with 34535 additions and 5774 deletions

View file

@ -36,11 +36,11 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentMethod whereShort($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentMethod whereShowAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentMethod whereUpdatedAt($value)
* @mixin \Eloquent
* @property string|null $max_price
* @method static \Illuminate\Database\Eloquent\Builder|PaymentMethod whereMaxPrice($value)
* @property array $show_on
* @method static \Illuminate\Database\Eloquent\Builder|PaymentMethod whereShowOn($value)
* @mixin \Eloquent
*/
class PaymentMethod extends Model
{
@ -71,14 +71,14 @@ class PaymentMethod extends Model
return isset(Type::$payShowATs[$this->show_at]) ? Type::$payShowATs[$this->show_at] : '-';
}
public function getShowOnTypes(){
public function getShowOnTypes($seperator = false){
$ret = [];
if($this->show_on && is_array($this->show_on)){
foreach($this->show_on as $show){
$ret[] = isset(Type::$payShowONs[$show]) ? Type::$payShowONs[$show] : '-';
}
}
return $ret;
return $seperator ? implode($seperator, $ret) : $ret;
}
public static function getDefaultAsArray($short=false){
@ -105,6 +105,9 @@ class PaymentMethod extends Model
$payment_method = PaymentMethod::whereShort($short)->first();
if($payment_method && $payment_method->active){
if(!$user_payment_methods || !is_array($user_payment_methods)){
abort(403, 'Fehler: Es sind keine Zahlungsmethoden hinterlegt');
}
if(in_array($payment_method->id, $user_payment_methods)){
if($total > 0 && $payment_method->max_price > 0){
if($payment_method->max_price >= $total){