ldc-crm/app/Models/Answer.php
Alexis Gousseau 303834bbca
Crm V4
- Make all tests pass Client (V4),CRMV2,CRMV4
- Simplify client submodule path
- Move App_url to .env.testing
2023-10-06 16:37:29 +02:00

53 lines
1.5 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
/**
* @property integer $id Id.
* @property string $answer Answer.
* @property integer $question_id Foreign key Question.
* @property-read \Illuminate\Support\Carbon $created_at Created date.
* @property-read \Illuminate\Support\Carbon $updated_at Updated date.
*
* @property-read \App\Models\Question $question Question BelongsTo relation.
* @property-read \Illuminate\Database\Eloquent\Collection<App\Models\Customer>
* $customers Customer BelongsToMany relation.
*/
class Answer extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $fillable = [
'answer',
];
// * RELATIONS
/**
* Question BelongsTo relation.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function question(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(Question::class);
}
/**
* Customer belongsToMany relation.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function customers(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
return $this->belongsToMany(Customer::class, 'customer_answer');
}
}