File: /var/www/html/sarvodayahospital/app/Models/CentreOfExcellence.php
<?php
namespace App\Models;
use App\Scopes\isActiveScope;
use App\Scopes\isPublishedScope;
use Illuminate\Database\Eloquent\Model;
class CentreOfExcellence extends Model
{
protected $with = ['specialities'];
protected static function booted()
{
static::addGlobalScope(new isPublishedScope);
static::addGlobalScope(new isActiveScope);
}
public function specialities()
{
return $this->hasMany(
Speciality::class,
'CentreOfExcellenceID'
)->select('SpecialityName', 'Slug', 'CentreOfExcellenceID')
->orderBy('Weight', 'ASC');
}
}