From 19d106a3edd839bb32f008b4c3c097b04def6c1e Mon Sep 17 00:00:00 2001 From: Leon Morival Date: Mon, 18 May 2026 17:23:19 +0200 Subject: [PATCH] feat: add height to users --- app/Http/Requests/UpdateUserRequest.php | 1 + app/Http/Resources/UserResource.php | 1 + app/Models/User.php | 1 + .../2026_05_18_152010_add_height_to_user.php | 28 +++++++++++++++++++ 4 files changed, 31 insertions(+) create mode 100644 database/migrations/2026_05_18_152010_add_height_to_user.php diff --git a/app/Http/Requests/UpdateUserRequest.php b/app/Http/Requests/UpdateUserRequest.php index 43c3181..b356960 100644 --- a/app/Http/Requests/UpdateUserRequest.php +++ b/app/Http/Requests/UpdateUserRequest.php @@ -16,6 +16,7 @@ class UpdateUserRequest extends FormRequest return [ 'name' => ['sometimes', 'string', 'max:255'], 'bio' => ['sometimes', 'nullable', 'string'], + 'height' => ['sometimes', 'nullable', 'integer'], 'avatar' => ['sometimes', 'nullable', 'image', 'max:2048'], 'nutritionGoals' => ['sometimes', 'array'], 'nutritionGoals.calories' => ['required_with:nutritionGoals', 'integer', 'min:0', 'max:100000'], diff --git a/app/Http/Resources/UserResource.php b/app/Http/Resources/UserResource.php index 3b905f0..7705cb3 100644 --- a/app/Http/Resources/UserResource.php +++ b/app/Http/Resources/UserResource.php @@ -18,6 +18,7 @@ class UserResource extends JsonResource return [ 'name' => $this->name, 'email' => $this->email, + 'height' => $this->height, 'avatarUrl' => $this->avatar_url ? asset(Storage::url($this->avatar_url)) : null, 'bio' => $this->bio, 'nutritionGoals' => [ diff --git a/app/Models/User.php b/app/Models/User.php index d91a775..4a15776 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -27,6 +27,7 @@ class User extends Authenticatable implements FilamentUser 'email', 'password', 'avatar_url', + 'height', 'bio', 'daily_calorie_goal', 'daily_protein_goal', diff --git a/database/migrations/2026_05_18_152010_add_height_to_user.php b/database/migrations/2026_05_18_152010_add_height_to_user.php new file mode 100644 index 0000000..0b348ab --- /dev/null +++ b/database/migrations/2026_05_18_152010_add_height_to_user.php @@ -0,0 +1,28 @@ +integer('height')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('user', function (Blueprint $table) { + $table->dropColumn('height'); + }); + } +};