#22 - vacation calendar (#51)

* change layout

* change layout

* #22 - wip

* wip

* wip

* #22 - wip

* #22 - wip

* #22 - wip

* #22 - wip

* #22 - fix

* #22 - wip

* #22 - added some tests

* #22 - wip

* #22 - wip

* #22 - fix

* #22 - wip

* #22 - wip

* #22 - wip

* #22 - fix

* #22 - fix

* #22 - fix

* #22 - fix

* #22 - fix

* #22 - fix

* #22 - cr fixes

* #22 - cr fix

Co-authored-by: EwelinaLasowy <ewelina.lasowy@blumilk.pl>
This commit is contained in:
Adrian Hopek
2022-02-15 15:08:26 +01:00
committed by GitHub
parent b161981d5a
commit 6c352b629c
50 changed files with 1682 additions and 397 deletions

View File

@@ -21,11 +21,11 @@ use Toby\Domain\Enums\VacationType;
* @property VacationRequestState $state
* @property Carbon $from
* @property Carbon $to
* @property int $estimated_days
* @property string $comment
* @property User $user
* @property YearPeriod $yearPeriod
* @property Collection $activities
* @property Collection $vacations
* @property Carbon $created_at
* @property Carbon $updated_at
*/
@@ -57,6 +57,11 @@ class VacationRequest extends Model
return $this->hasMany(VacationRequestActivity::class);
}
public function vacations(): HasMany
{
return $this->hasMany(Vacation::class);
}
public function changeStateTo(VacationRequestState $state): void
{
$this->state = $state;
@@ -69,6 +74,11 @@ class VacationRequest extends Model
return $query->whereIn("state", $states);
}
public function scopeNoStates(Builder $query, array $states): Builder
{
return $query->whereNotIn("state", $states);
}
public function scopeOverlapsWith(Builder $query, self $vacationRequest): Builder
{
return $query->where("from", "<=", $vacationRequest->to)