feat: add height to users
This commit is contained in:
parent
5a81c27665
commit
19d106a3ed
|
|
@ -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'],
|
||||
|
|
|
|||
|
|
@ -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' => [
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ class User extends Authenticatable implements FilamentUser
|
|||
'email',
|
||||
'password',
|
||||
'avatar_url',
|
||||
'height',
|
||||
'bio',
|
||||
'daily_calorie_goal',
|
||||
'daily_protein_goal',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->integer('height')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('user', function (Blueprint $table) {
|
||||
$table->dropColumn('height');
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue