* #23 - wip * #23 - wip * #23 - wip * #23 - wip * #23 - fix * #23 - ecs fix * #23 - fix * #23 - fix * #23 - cr fix
This commit is contained in:
		| @@ -6,10 +6,12 @@ namespace Toby\Models; | ||||
|  | ||||
| use Illuminate\Database\Eloquent\Builder; | ||||
| use Illuminate\Database\Eloquent\Factories\HasFactory; | ||||
| use Illuminate\Database\Eloquent\Relations\HasMany; | ||||
| use Illuminate\Database\Eloquent\SoftDeletes; | ||||
| use Illuminate\Foundation\Auth\User as Authenticatable; | ||||
| use Illuminate\Notifications\Notifiable; | ||||
| use Illuminate\Support\Carbon; | ||||
| use Illuminate\Support\Collection; | ||||
| use Toby\Enums\EmploymentForm; | ||||
|  | ||||
| /** | ||||
| @@ -19,6 +21,7 @@ use Toby\Enums\EmploymentForm; | ||||
|  * @property string $avatar | ||||
|  * @property EmploymentForm $employment_form | ||||
|  * @property Carbon $employment_date | ||||
|  * @property Collection $vacationLimits | ||||
|  */ | ||||
| class User extends Authenticatable | ||||
| { | ||||
| @@ -43,6 +46,11 @@ class User extends Authenticatable | ||||
|         "remember_token", | ||||
|     ]; | ||||
|  | ||||
|     public function vacationLimits(): HasMany | ||||
|     { | ||||
|         return $this->hasMany(VacationLimit::class); | ||||
|     } | ||||
|  | ||||
|     public function scopeSearch(Builder $query, ?string $text): Builder | ||||
|     { | ||||
|         if ($text === null) { | ||||
| @@ -53,4 +61,11 @@ class User extends Authenticatable | ||||
|             ->where("name", "LIKE", "%{$text}%") | ||||
|             ->orWhere("email", "LIKE", "%{$text}%"); | ||||
|     } | ||||
|  | ||||
|     public function saveAvatar(string $path): void | ||||
|     { | ||||
|         $this->avatar = $path; | ||||
|  | ||||
|         $this->save(); | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user