1
0
mirror of https://github.com/robonen/education-project.git synced 2026-03-20 10:54:31 +00:00

Создание, обновление, получение, фильтрация

This commit is contained in:
nikden13
2020-12-04 11:09:57 +07:00
parent 4a8e802c03
commit 45bec16c7f
7 changed files with 266 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Filters;
use Carbon\Carbon;
class TimetableFilter extends QueryFilter
{
protected function class($value)
{
$this->builder = $this->builder->where('class_id', $value);
}
protected function teacher($value)
{
$this->builder = $this->builder->where('teacher_id', $value);
}
protected function subject($value)
{
$this->builder = $this->builder->where('type_event', $value);
}
protected function classroom($value)
{
$this->builder = $this->builder->where('classroom', $value);
}
protected function date($value)
{
$start_date = str_replace('/', '-', $value);
$end_date = Carbon::parse($start_date)
->addDays(5)
->format('Y-m-d');
$this->builder = $this->builder->whereBetween('date', [$start_date, $end_date]);
}
}