-membuat model, migrasi seeder dan faker -membuat relasi di user -membuat test untuk memastikan jalannya aplikasi
29 lines
563 B
PHP
29 lines
563 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\Gender;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Customer extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'gender' => Gender::class,
|
|
];
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|