2021-08-10 12:09:49 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
|
|
class Answer extends Model
|
|
|
|
|
{
|
|
|
|
|
use HasFactory;
|
|
|
|
|
|
|
|
|
|
protected $fillable = [
|
|
|
|
|
'answer'
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Question BelongsTo relation
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
|
*/
|
|
|
|
|
public function question()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Question::class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-08-11 17:25:24 +02:00
|
|
|
* Answer belongsToMany relation
|
2021-08-10 12:09:49 +02:00
|
|
|
*
|
2021-08-11 17:25:24 +02:00
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
2021-08-10 12:09:49 +02:00
|
|
|
*/
|
2021-08-11 17:25:24 +02:00
|
|
|
public function customers()
|
2021-08-10 12:09:49 +02:00
|
|
|
{
|
2021-08-11 17:25:24 +02:00
|
|
|
return $this->belongsToMany(Customer::class, 'customer_answer');
|
2021-08-10 12:09:49 +02:00
|
|
|
}
|
|
|
|
|
}
|