44 خطوط
992 B
PHP
44 خطوط
992 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Product extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $fillable = [
|
|
'name', 'category', 'base_price', 'description', 'is_active',
|
|
'sales_script_id', 'faq', 'objection_handling', 'created_by',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'base_price' => 'decimal:2',
|
|
'is_active' => 'boolean',
|
|
'faq' => 'array',
|
|
'objection_handling' => 'array',
|
|
];
|
|
}
|
|
|
|
public function salesScript(): BelongsTo
|
|
{
|
|
return $this->belongsTo(SalesScript::class);
|
|
}
|
|
|
|
public function deals(): HasMany
|
|
{
|
|
return $this->hasMany(Deal::class);
|
|
}
|
|
|
|
public function campaigns(): HasMany
|
|
{
|
|
return $this->hasMany(Campaign::class);
|
|
}
|
|
}
|