45 lines
1 KiB
PHP
45 lines
1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\PaymentOptionType;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class PaymentOption extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $fillable = [
|
|
'article_number',
|
|
'type',
|
|
'price_cents',
|
|
'currency',
|
|
'interval',
|
|
'is_hidden',
|
|
'stripe_product_id',
|
|
'stripe_price_id',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'type' => PaymentOptionType::class,
|
|
'price_cents' => 'integer',
|
|
'is_hidden' => 'boolean',
|
|
'deleted_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function translations(): HasMany
|
|
{
|
|
return $this->hasMany(PaymentOptionTranslation::class);
|
|
}
|
|
|
|
public function userPaymentOptions(): HasMany
|
|
{
|
|
return $this->hasMany(UserPaymentOption::class);
|
|
}
|
|
}
|