Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
7 / 7 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
ConversionTransaction | |
100.00% |
7 / 7 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
user | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
status | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
jsonSerialize | |
100.00% |
5 / 5 |
|
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 ConversionTransaction extends Model |
13 | { |
14 | use HasFactory; |
15 | |
16 | protected $table = "conversion_transactions"; |
17 | |
18 | |
19 | /** |
20 | * User name relationship |
21 | */ |
22 | public function user():hasOne |
23 | { |
24 | return $this->hasOne('App\Models\User', 'id', 'user_id'); |
25 | } |
26 | |
27 | |
28 | /** |
29 | * Status name relationship |
30 | */ |
31 | public function status():hasOne |
32 | { |
33 | return $this->hasOne('App\Models\ConversionStatus', 'id', 'status_id'); |
34 | } |
35 | |
36 | |
37 | /** |
38 | * Serialization |
39 | */ |
40 | public function jsonSerialize() |
41 | { |
42 | return [ |
43 | 'id' => $this->id, |
44 | 'status' => $this->status->name, |
45 | 'user' => $this->user, |
46 | 'note' => $this->note, |
47 | 'created_at' => $this->created_at, |
48 | ]; |
49 | } // jsonSerialize |
50 | } |