донат шоп, управление магазином, яндекс метрика

This commit is contained in:
2026-07-19 19:17:29 +04:00
parent 8bf1b852f0
commit df7f98fe8b
48 changed files with 1859 additions and 18 deletions
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class BalanceTransaction extends Model
{
public const TYPE_DEPOSIT = 'deposit';
public const TYPE_SPEND = 'spend';
public const TYPE_ADMIN_CREDIT = 'admin_credit';
public const TYPE_ADMIN_DEBIT = 'admin_debit';
protected $connection = 'azerothcore_auth';
protected $table = 'balance_transactions';
protected $guarded = [];
public const UPDATED_AT = null;
protected function casts(): array
{
return ['amount' => 'decimal:2', 'balance_after' => 'decimal:2', 'metadata' => 'array'];
}
}
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PaymentInvoice extends Model
{
public const STATUS_PENDING = 'pending';
public const STATUS_PAID = 'paid';
public const MODE_TEST = 'test';
public const MODE_PRODUCTION = 'production';
protected $connection = 'azerothcore_auth';
protected $table = 'payment_invoices';
protected $guarded = [];
protected function casts(): array
{
return ['amount' => 'decimal:2', 'paid_at' => 'datetime'];
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class ShopCategory extends Model
{
protected $connection = 'store';
protected $table = 'store_categories';
public $timestamps = false;
protected $fillable = ['name', 'icon', 'requiredRank', 'flags', 'enabled'];
protected function casts(): array
{
return ['requiredRank' => 'integer', 'flags' => 'integer', 'enabled' => 'bool'];
}
public function products(): BelongsToMany
{
return $this->belongsToMany(ShopProduct::class, 'store_category_service_link', 'category', 'service');
}
public function scopeOrdered(Builder $query): Builder
{
return $query->orderBy('id');
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class ShopProduct extends Model
{
protected $connection = 'store';
protected $table = 'store_services';
public $timestamps = false;
protected $guarded = ['id'];
protected function casts(): array
{
return ['price' => 'integer', 'discountAmount' => 'integer', 'new' => 'bool', 'enabled' => 'bool'];
}
public function categories(): BelongsToMany
{
return $this->belongsToMany(ShopCategory::class, 'store_category_service_link', 'service', 'category');
}
public function scopeOrdered(Builder $query): Builder
{
return $query->orderBy('id');
}
}