Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| ConversionNote | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| author | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| jsonSerialize | |
100.00% |
4 / 4 |
|
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 | use Illuminate\Database\Eloquent\Relations\HasOne; |
| 8 | use Illuminate\Database\Eloquent\Relations\HasMany; |
| 9 | use Illuminate\Database\Eloquent\Relations\BelongsTo; |
| 10 | use Illuminate\Database\Eloquent\Relations\BelongsToMany; |
| 11 | |
| 12 | class ConversionNote extends Model |
| 13 | { |
| 14 | use HasFactory; |
| 15 | |
| 16 | protected $table = 'conversion_notes'; |
| 17 | |
| 18 | /** |
| 19 | * Author name relationship |
| 20 | */ |
| 21 | public function author():hasOne |
| 22 | { |
| 23 | return $this->hasOne('App\Models\User', 'id', 'user_id'); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Serialization |
| 28 | */ |
| 29 | public function jsonSerialize() |
| 30 | { |
| 31 | return [ |
| 32 | 'id' => $this->id, |
| 33 | 'note' => $this->note, |
| 34 | 'created_at' => $this->created_at, |
| 35 | 'author' => $this->author, |
| 36 | ]; |
| 37 | } // jsonSerialize |
| 38 | } |