12-05-2026 Frontend dev
This commit is contained in:
parent
405df0a122
commit
5b8bdf4182
779 changed files with 480564 additions and 6241 deletions
61
app/Models/UserPaymentOption.php
Normal file
61
app/Models/UserPaymentOption.php
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\UserPaymentOptionStatus;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class UserPaymentOption extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'payment_option_id',
|
||||
'status',
|
||||
'grandfathered_until',
|
||||
'legacy_conditions',
|
||||
'current_period_start',
|
||||
'current_period_end',
|
||||
'stripe_subscription_id',
|
||||
'cancelled_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'status' => UserPaymentOptionStatus::class,
|
||||
'grandfathered_until' => 'date',
|
||||
'legacy_conditions' => 'array',
|
||||
'current_period_start' => 'date',
|
||||
'current_period_end' => 'date',
|
||||
'cancelled_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function paymentOption(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PaymentOption::class);
|
||||
}
|
||||
|
||||
public function companies(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Company::class, 'user_payment_option_company')
|
||||
->withPivot('is_active')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function payments(): HasMany
|
||||
{
|
||||
return $this->hasMany(UserPayment::class);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue