ldc-legaulois/app/Models/Claim.php
2024-06-10 16:51:32 +02:00

52 lines
1.2 KiB
PHP

<?php
namespace App\Models;
use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
/**
* @property string $label Claim label.
* @property boolean $published Claim publish status.
* @property-read \Carbon\Carbon $created_at Created date.
* @property-read \Carbon\Carbon $updated_at Updated date.
*
* @property-read \App\Models\Product $products Product polymorphic relationship.
*/
class Claim extends Model
{
use ActivityLog;
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'label',
'published',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'published' => 'boolean',
];
// * RELATIONSHIPS
/**
* Get all of the products for the product type.
*
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany
*/
public function products(): \Illuminate\Database\Eloquent\Relations\MorphToMany
{
return $this->morphToMany(Product::class, 'productable');
}
}