File: /var/www/vhost/disk-apps/alq-cali.bikenow.co/app/Models/Membership/Membership.php
<?php
namespace App\Models\Membership;
use App\Models\Concerns\PageSize;
use App\PaymentTransaction;
use App\Tag;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Membership extends Model
{
use PageSize;
protected $fillable = [
'name',
'description',
'price',
'billing_interval',
'conditions',
'terms_text',
'terms_confirm',
'terms_and_conditions',
'action',
'deliverable',
];
protected $casts = [
'price' => 'float',
'active' => 'boolean',
'deliverable' => 'boolean',
];
public function tags(): BelongsToMany
{
return $this->belongsToMany(Tag::class, 'membership_tags')->where('tags.active', 1)->withTimestamps();
}
function payment_transaction(): BelongsTo
{
return $this->belongsTo(PaymentTransaction::class)->with('gateway_payments');
}
public function list_tags(): BelongsToMany
{
return $this->belongsToMany(Tag::class, 'membership_list_tags')->where('tags.active', 1)->withTimestamps();
}
}