- menambahkan kolom baru yaitu reward point - menambahkan tier baru di seeder yaitu "Bronze"
33 lines
609 B
PHP
33 lines
609 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Veelasky\LaravelHashId\Eloquent\HashableId;
|
|
|
|
class Membership extends Model
|
|
{
|
|
use HashableId;
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'tier_points' => 'int',
|
|
'reward_points' => 'int',
|
|
];
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function tier(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Tier::class);
|
|
}
|
|
}
|