Some checks failed
tests / ci (pull_request) Has been cancelled
- Changed user creation to use 'username' instead of 'name'. - Added UserProfile model with relationships to User and gender enum. - Updated validation rules for username and email. - Modified migrations to create user_profiles table and adjust users table. - Updated seeder to create users with profiles. - Translated various UI texts to Indonesian and improved layout components.
29 lines
581 B
PHP
29 lines
581 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\Gender;
|
|
use Illuminate\Database\Eloquent\Attributes\Guarded;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
#[Guarded(['id'])]
|
|
class UserProfile extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'gender' => Gender::class,
|
|
'birth_date' => 'date',
|
|
];
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|