yoco updated to use webhook

This commit is contained in:
twotalesanimation
2025-12-29 14:43:24 +02:00
parent 6de01c13c5
commit 00b8ff77b2
123 changed files with 6959 additions and 12669 deletions
+40
View File
@@ -0,0 +1,40 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AppSetting extends Model
{
protected $fillable = ['key', 'value', 'type', 'description'];
/**
* Get a setting by key
*/
public static function get(string $key, mixed $default = null): mixed
{
$setting = self::where('key', $key)->first();
if (!$setting) {
return $default;
}
return match ($setting->type) {
'integer' => (int) $setting->value,
'boolean' => (bool) $setting->value,
'json' => json_decode($setting->value, true),
default => $setting->value,
};
}
/**
* Set a setting
*/
public static function set(string $key, mixed $value, string $type = 'string'): void
{
self::updateOrCreate(
['key' => $key],
['value' => is_array($value) ? json_encode($value) : (string) $value, 'type' => $type]
);
}
}