49 lines
1002 B
PHP
49 lines
1002 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Modules\Authentication\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||
|
|
|
||
|
|
class Subscription extends Model
|
||
|
|
{
|
||
|
|
use SoftDeletes;
|
||
|
|
|
||
|
|
protected $guarded = ['id'];
|
||
|
|
|
||
|
|
protected $hidden = [
|
||
|
|
'updated_at',
|
||
|
|
'is_active',
|
||
|
|
'deleted_at',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected function casts(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'created_at' => 'datetime',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function user(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(User::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function package(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Package::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function subscriptionItems(): HasMany
|
||
|
|
{
|
||
|
|
return $this->hasMany(SubscriptionItem::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function restaurant(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Restaurant::class, 'restaurant_id', 'id');
|
||
|
|
}
|
||
|
|
}
|