Edit File: Subscription.php
<?php namespace App\Models; use App\Traits\ModelTrait; class Subscription extends BaseModel { use ModelTrait; protected $fillable = [ 'user_id', 'package_id', 'price', 'vat_amount', 'final_price', 'vat_ratio', 'start_date', 'end_date', 'type', 'is_active', 'payment_type', ]; public function user() { return $this->belongsTo(User::class); } public function package() { return $this->belongsTo(Package::class); } public function scopeActive() { return $this->where('is_active', 1); } public function scopeActiveDate() { return $this->whereDate('start_date', '<=', date('Y-m-d')) ->whereDate('end_date', '>=', date('Y-m-d')); } }
Back to File Manager