42 lines
850 B
PHP
42 lines
850 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||
|
|
|
||
|
|
class Goal extends Model
|
||
|
|
{
|
||
|
|
use HasFactory;
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'website_id',
|
||
|
|
'name',
|
||
|
|
'type',
|
||
|
|
'conditions',
|
||
|
|
'default_value',
|
||
|
|
'is_active',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected function casts(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'conditions' => 'array',
|
||
|
|
'default_value' => 'decimal:4',
|
||
|
|
'is_active' => 'boolean',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function website(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Website::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function conversions(): HasMany
|
||
|
|
{
|
||
|
|
return $this->hasMany(GoalConversion::class);
|
||
|
|
}
|
||
|
|
}
|