37 lines
824 B
PHP
37 lines
824 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
|
class Segment extends Model
|
|
{
|
|
/** @use HasFactory<\Database\Factories\SegmentFactory> */
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'description',
|
|
'active',
|
|
'exclude'
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'active' => 'boolean',
|
|
'exclude' => 'boolean'
|
|
];
|
|
}
|
|
|
|
public function contracts(): BelongsToMany {
|
|
return $this->belongsToMany(\App\Models\Contract::class);
|
|
}
|
|
|
|
public function clientCase(): BelongsToMany {
|
|
return $this->belongsToMany(\App\Models\ClientCase::class)->withTimestamps();
|
|
}
|
|
}
|