ldc-crm/app/Models/ModelAnswer.php
2025-09-08 14:25:11 +02:00

89 lines
1.9 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* @property integer $answer_id
* @property integer $model_id
* @property string $model_type
* @property-read \Illuminate\Support\Carbon $created_at
*
* @property \App\Models\Answer $answer
* @property \Illuminate\Database\Eloquent\Model $relatedModel
*/
class ModelAnswer extends Model
{
/**
* Define table name.
*
* @var string
*/
protected $table = 'model_answer';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = null;
/**
* Indicates if the IDs are auto-incrementing.
*
* @var boolean
*/
public $incrementing = false;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $fillable = [
'answer_id',
'model_id',
'model_type',
];
/**
* The attributes that should be cast to native types.
*
* @var array<string, mixed>
*/
protected $casts = [
'model_id' => 'string',
];
/**
* Inhibit update_at column as we only have
* created_at.
*
* @return null
*/
public function getUpdatedAtColumn(): null
{
return null;
}
/**
* Customer belongsTo relation.
*
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
*/
public function relatedModel(): \Illuminate\Database\Eloquent\Relations\MorphTo
{
return $this->morphTo();
}
/**
* Relation vers la réponse.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function answer(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(Answer::class);
}
}