23 lines
597 B
PHP
23 lines
597 B
PHP
<?php
|
|
|
|
namespace App\DAL\Studies;
|
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
|
|
final class TechnicianWorklist extends WorklistBase
|
|
{
|
|
protected function buildQuery(?int $user_id = null): Builder
|
|
{
|
|
$query = $this->getStudiesQuery();
|
|
$department_id = auth()->user()->department_id;
|
|
if ($department_id) {
|
|
$query = $query->where('department_id', $department_id);
|
|
} else {
|
|
$organization_id = auth()->user()->organization_id;
|
|
$query = $query->where('organization_id', $organization_id);
|
|
}
|
|
|
|
return $query;
|
|
}
|
|
}
|