Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
33.33% |
1 / 3 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| GoogleAdsCustomer | |
33.33% |
1 / 3 |
|
50.00% |
1 / 2 |
3.19 | |
0.00% |
0 / 1 |
| scopeWhereMine | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| jsonSerialize | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| 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\Builder; |
| 8 | use Illuminate\Database\Eloquent\Relations\HasOne; |
| 9 | use Illuminate\Database\Eloquent\Relations\HasMany; |
| 10 | use Illuminate\Database\Eloquent\Relations\BelongsTo; |
| 11 | use Illuminate\Database\Eloquent\Relations\BelongsToMany; |
| 12 | |
| 13 | class 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 | } |