- small changes (#98)
* - added some test * - cr fix * wip * wip * Update resources/js/Shared/MainMenu.vue Co-authored-by: Ewelina Lasowy <56546832+EwelinaLasowy@users.noreply.github.com> * fix Co-authored-by: EwelinaLasowy <ewelina.lasowy@blumilk.pl> Co-authored-by: Ewelina Lasowy <56546832+EwelinaLasowy@users.noreply.github.com>
This commit is contained in:
@@ -71,18 +71,6 @@ class User extends Authenticatable
|
||||
return $this->hasMany(Vacation::class);
|
||||
}
|
||||
|
||||
public function scopeSearch(Builder $query, ?string $text): Builder
|
||||
{
|
||||
if ($text === null) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
return $query
|
||||
->where("first_name", "ILIKE", $text)
|
||||
->orWhere("last_name", "ILIKE", $text)
|
||||
->orWhere("email", "ILIKE", $text);
|
||||
}
|
||||
|
||||
public function getAvatar(): string
|
||||
{
|
||||
return $this->getAvatarGenerator()
|
||||
@@ -108,6 +96,28 @@ class User extends Authenticatable
|
||||
->exists();
|
||||
}
|
||||
|
||||
public function scopeSearch(Builder $query, ?string $text): Builder
|
||||
{
|
||||
if ($text === null) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
return $query
|
||||
->where("first_name", "ILIKE", $text)
|
||||
->orWhere("last_name", "ILIKE", $text)
|
||||
->orWhere("email", "ILIKE", $text);
|
||||
}
|
||||
|
||||
public function scopeWithVacationLimitIn(Builder $query, YearPeriod $yearPeriod): Builder
|
||||
{
|
||||
return $query->whereRelation(
|
||||
"vacationlimits",
|
||||
fn(Builder $query) => $query
|
||||
->where("year_period_id", $yearPeriod->id)
|
||||
->whereNotNull("days"),
|
||||
);
|
||||
}
|
||||
|
||||
protected function getAvatarName(): string
|
||||
{
|
||||
return mb_substr($this->first_name, 0, 1) . mb_substr($this->last_name, 0, 1);
|
||||
|
Reference in New Issue
Block a user