Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
33.33% covered (danger)
33.33%
1 / 3
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
GoogleAdsCustomer
33.33% covered (danger)
33.33%
1 / 3
50.00% covered (danger)
50.00%
1 / 2
3.19
0.00% covered (danger)
0.00%
0 / 1
 scopeWhereMine
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 jsonSerialize
0.00% covered (danger)
0.00%
0 / 2
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\Builder;
8use Illuminate\Database\Eloquent\Relations\HasOne;
9use Illuminate\Database\Eloquent\Relations\HasMany;
10use Illuminate\Database\Eloquent\Relations\BelongsTo;
11use Illuminate\Database\Eloquent\Relations\BelongsToMany;
12
13class GoogleAdsCustomer extends Model
14{
15    use HasFactory;
16
17    protected $table = 'google_ads_customers';
18
19    /**
20     * Get customers for session user
21     */
22    public function scopeWhereMine(Builder $query):Builder
23    {
24        return $query->where('user_id', '=', auth()->guard('api')->user()->id);
25    }
26
27    /**
28     * Serialization
29     */
30    public function jsonSerialize()
31    {
32        return [
33            'customer_id' => $this->customer_id,
34            'customer_descriptive_name' => $this->customer_descriptive_name,
35        ];
36    } // jsonSerialize
37}