CourseWork/app/Services/LessonService.php
m.zargarov d4cabb23b7 Fix
2024-06-24 00:51:05 +04:00

24 lines
491 B
PHP

<?php
namespace App\Services;
use App\Models\Grade;
use App\Models\Teacher;
use Illuminate\Support\Facades\Auth;
class LessonService
{
public function getLessons(Grade $grade)
{
if (Auth::user()->userable_type == Teacher::class) {
return $grade
->lessons()
->where('teacher_id', Auth::user()->userable_id)
->filter()
->get();
}
return $grade->lessons()->filter()->get();
}
}