Исправлен индикатор заполненного отчета в статистике

This commit is contained in:
brusnitsyn
2026-06-02 08:41:19 +09:00
parent 0a882b0cb2
commit 102ba46641
2 changed files with 22 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class ReportDuty extends Model
@@ -25,6 +26,25 @@ class ReportDuty extends Model
'period_end' => 'datetime:Y-m-d H:i:s',
];
public function scopeWithinPeriod(Builder $query, string $startAt, string $endAt): Builder
{
return $query
->where('period_end', '>=', $startAt)
->where('period_start', '<=', $endAt);
}
public function scopeExactPeriod(Builder $query, string $startAt, string $endAt): Builder
{
return $query
->where('period_start', '>=', $startAt)
->where('period_end', '<=', $endAt);
}
public function scopeOnlySubmitted(Builder $query): Builder
{
return $query->where('status_id', 2);
}
public function department()
{
return $this->belongsTo(Department::class, 'rf_department_id', 'department_id');