#22 - wip
This commit is contained in:
		| @@ -14,6 +14,7 @@ use Illuminate\Support\Carbon; | ||||
|  * @property Carbon $date | ||||
|  * @property User $user | ||||
|  * @property VacationRequest $vacationRequest | ||||
|  * @property YearPeriod $yearPeriod | ||||
|  */ | ||||
| class Vacation extends Model | ||||
| { | ||||
| @@ -34,4 +35,9 @@ class Vacation extends Model | ||||
|     { | ||||
|         return $this->belongsTo(VacationRequest::class); | ||||
|     } | ||||
|  | ||||
|     public function yearPeriod(): BelongsTo | ||||
|     { | ||||
|         return $this->belongsTo(YearPeriod::class); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -21,7 +21,6 @@ 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 | ||||
| @@ -75,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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user