Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
UserConversionTransaction
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 status
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 conversion
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 jsonSerialize
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Models;
4
5use Illuminate\Database\Eloquent\Factories\HasFactory;
6use Illuminate\Database\Eloquent\Model;
7use Illuminate\Database\Eloquent\Relations\HasOne;
8use Illuminate\Database\Eloquent\Relations\HasMany;
9use Illuminate\Database\Eloquent\Relations\BelongsTo;
10use Illuminate\Database\Eloquent\Relations\BelongsToMany;
11
12class UserConversionTransaction extends Model
13{
14    use HasFactory;
15
16    protected $table = "conversion_transactions";
17
18    /**
19     * Status name relationship
20     */
21    public function status():hasOne
22    {
23        return $this->hasOne('App\Models\ConversionStatus', 'id', 'status_id');
24    }
25
26
27    /**
28     * Conversion relationship
29     */
30    public function conversion():hasOne
31    {
32        return $this->hasOne('App\Models\Conversion', 'id', 'conversion_id');
33    }
34
35    /**
36     * Serialization
37     */
38    public function jsonSerialize()
39    {
40        return [
41            'id' => $this->id,
42            'event' => $this->event,
43            'status' => $this->status->name,
44            'note' => $this->note,
45            'created_at' => $this->created_at,
46            'conversion' => [
47                'id' => $this->conversion->id,
48                'gclid' => $this->conversion->gclid,
49                'fbclid' => $this->conversion->fbclid,
50                'website_url' => $this->conversion->website_url,
51                'status' => $this->conversion->status->name,
52            ],
53        ];
54    } // jsonSerialize
55}