feat: add height to users
This commit is contained in:
parent
5a81c27665
commit
19d106a3ed
|
|
@ -16,6 +16,7 @@ class UpdateUserRequest extends FormRequest
|
||||||
return [
|
return [
|
||||||
'name' => ['sometimes', 'string', 'max:255'],
|
'name' => ['sometimes', 'string', 'max:255'],
|
||||||
'bio' => ['sometimes', 'nullable', 'string'],
|
'bio' => ['sometimes', 'nullable', 'string'],
|
||||||
|
'height' => ['sometimes', 'nullable', 'integer'],
|
||||||
'avatar' => ['sometimes', 'nullable', 'image', 'max:2048'],
|
'avatar' => ['sometimes', 'nullable', 'image', 'max:2048'],
|
||||||
'nutritionGoals' => ['sometimes', 'array'],
|
'nutritionGoals' => ['sometimes', 'array'],
|
||||||
'nutritionGoals.calories' => ['required_with:nutritionGoals', 'integer', 'min:0', 'max:100000'],
|
'nutritionGoals.calories' => ['required_with:nutritionGoals', 'integer', 'min:0', 'max:100000'],
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ class UserResource extends JsonResource
|
||||||
return [
|
return [
|
||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
'email' => $this->email,
|
'email' => $this->email,
|
||||||
|
'height' => $this->height,
|
||||||
'avatarUrl' => $this->avatar_url ? asset(Storage::url($this->avatar_url)) : null,
|
'avatarUrl' => $this->avatar_url ? asset(Storage::url($this->avatar_url)) : null,
|
||||||
'bio' => $this->bio,
|
'bio' => $this->bio,
|
||||||
'nutritionGoals' => [
|
'nutritionGoals' => [
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ class User extends Authenticatable implements FilamentUser
|
||||||
'email',
|
'email',
|
||||||
'password',
|
'password',
|
||||||
'avatar_url',
|
'avatar_url',
|
||||||
|
'height',
|
||||||
'bio',
|
'bio',
|
||||||
'daily_calorie_goal',
|
'daily_calorie_goal',
|
||||||
'daily_protein_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