status == 1 ? ' Active ' : 'Inactive';
}
protected function createdBy(): Attribute
{
return Attribute::make(
get: fn($value) => User::find($value) ? User::find($value)->name : '',
);
}
protected function updatedBy(): Attribute
{
return Attribute::make(
get: fn($value) => User::find($value) ? User::find($value)->name : '',
);
}
public function parent()
{
return $this->belongsTo(Preparationclasses::class, 'parent_preparationclass');
}
public function children()
{
return $this->hasMany(Preparationclasses::class, 'parent_preparationclass')
->where('status', 1)
->orderBy('display_order', 'asc');
}
public function offerClasses()
{
return $this->hasMany(Preparationclassoffers::class, 'preparationclasses_id')
->where('status', 1);
}
public function testimonials()
{
return $this->hasMany(Preparationclasstestimonials::class, 'preparationclasses_id')
->where('status', 1);
}
}