|
Server : Apache/2.4.41 (Ubuntu) System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.2.12 Disable Function : NONE Directory : /var/www/lecturebazaar.com/app/Models/Api/ |
Upload File : |
<?php
namespace App\Models\Api;
use App\Models\Api\Traits\CheckForSaleTrait;
use App\Models\Favorite;
use App\Models\Bundle as Model;
class Bundle extends Model
{
use CheckForSaleTrait;
public function getIsFavoriteAttribute()
{
if (!apiAuth()) {
return null;
}
return (bool)Favorite::where('bundle_id', $this->id)
->where('user_id', apiAuth()->id)
->first();
}
public function bundleWebinars()
{
return $this->hasMany('App\Models\Api\BundleWebinar', 'bundle_id', 'id');
}
public function webinars()
{
// return $this->hasManyThrough('App\Models\Webinar', 'App\Models\BundleWebinar', 'bundle_id', 'id');
}
public function teacher()
{
return $this->belongsTo('App\Models\Api\User', 'teacher_id', 'id');
}
}