Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| Answer | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| question | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| customers | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Models; |
| 4 | |
| 5 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
| 6 | use Illuminate\Database\Eloquent\Model; |
| 7 | |
| 8 | class Answer extends Model |
| 9 | { |
| 10 | use HasFactory; |
| 11 | |
| 12 | /** |
| 13 | * The attributes that are mass assignable. |
| 14 | * |
| 15 | * @var string[] |
| 16 | */ |
| 17 | protected $fillable = [ |
| 18 | 'answer' |
| 19 | ]; |
| 20 | |
| 21 | // * RELATIONS |
| 22 | |
| 23 | /** |
| 24 | * Question BelongsTo relation |
| 25 | * |
| 26 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
| 27 | */ |
| 28 | public function question() |
| 29 | { |
| 30 | return $this->belongsTo(Question::class); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Answer belongsToMany relation |
| 35 | * |
| 36 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
| 37 | */ |
| 38 | public function customers() |
| 39 | { |
| 40 | return $this->belongsToMany(Customer::class, 'customer_answer'); |
| 41 | } |
| 42 | } |