26 lines
482 B
PHP
26 lines
482 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\PriceType;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class ProductPrice extends Model
|
|
{
|
|
protected $guarded = ['id'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'price_type' => PriceType::class,
|
|
'price' => 'integer',
|
|
];
|
|
}
|
|
|
|
public function product(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Product::class);
|
|
}
|
|
}
|