GoalBidModifier.php
5.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<?php
namespace App\Models\Pivots;
use App\Models\BidModifier;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* App\Models\Pivots\GoalBidModifier
*
* @property int $id
* @property int|null $external_id
* @property int|null $dictionary_campaign_external_id
* @property int|null $goal_ad_group_external_id
* @property int $dictionary_campaign_id
* @property int $goal_ad_group_id
* @property int $bid_modifier_id
* @property \Illuminate\Support\Carbon|null $external_upload_at
* @property \Illuminate\Support\Carbon|null $external_updated_at
* @property \Illuminate\Support\Carbon|null $updated_need
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read BidModifier $bidModifier
* @method static Builder|BidModifiers forExternal()
* @method static Builder|BidModifiers forNotExternal()
* @method static Builder|BidModifiers forNotReserveCreate()
* @method static Builder|BidModifiers needUpdated()
* @method static Builder|BidModifiers newModelQuery()
* @method static Builder|BidModifiers newQuery()
* @method static Builder|BidModifiers query()
* @method static Builder|BidModifiers whereCreatedAt($value)
* @method static Builder|BidModifiers whereDictionaryCampaignExternalId($value)
* @method static Builder|BidModifiers whereDictionaryCampaignId($value)
* @method static Builder|BidModifiers whereExternalId($value)
* @method static Builder|BidModifiers whereExternalUpdatedAt($value)
* @method static Builder|BidModifiers whereExternalUploadAt($value)
* @method static Builder|BidModifiers whereGoalAdGroupExternalId($value)
* @method static Builder|BidModifiers whereGoalAdGroupId($value)
* @method static Builder|BidModifiers whereId($value)
* @method static Builder|BidModifiers whereBidModifierId($value)
* @method static Builder|BidModifiers whereUpdatedAt($value)
* @method static Builder|BidModifiers whereUpdatedNeed($value)
* @mixin \Eloquent
*/
class GoalBidModifier extends Pivot
{
use SoftDeletes;
const LEVEL_CAMPAIGN = 'CAMPAIGN';
const LEVEL_AD_GROUP = 'AD_GROUP';
const TYPE_MOBILE_ADJUSTMENT = 'MOBILE_ADJUSTMENT';
const TYPE_DESKTOP_ADJUSTMENT = 'DESKTOP_ADJUSTMENT';
const TYPE_DEMOGRAPHICS_ADJUSTMENT = 'DEMOGRAPHICS_ADJUSTMENT';
const TYPE_RETARGETING_ADJUSTMENT = 'RETARGETING_ADJUSTMENT';
const TYPE_REGIONAL_ADJUSTMENT = 'REGIONAL_ADJUSTMENT';
const TYPE_VIDEO_ADJUSTMENT = 'VIDEO_ADJUSTMENT';
const TYPE_SMART_AD_ADJUSTMENT = 'SMART_AD_ADJUSTMENT';
protected $table = 'goal_bid_modifiers';
protected $fillable = [
'external_id',
'goal_ad_group_external_id',
'dictionary_campaign_external_id',
'goal_ad_group_id',
'dictionary_campaign_id',
'bid_modifier_id',
'level',
'type',
'mobile_adjustment',
'desktop_adjustment',
'demographics_adjustment',
'retargeting_adjustment',
'external_upload_at',
'external_updated_at',
'updated_need',
'reserve_create_at',
'reserve_update_at',
];
protected $casts = [
'mobile_adjustment' => 'json',
'desktop_adjustment' => 'json',
'demographics_adjustment' => 'json',
'retargeting_adjustment' => 'json',
'external_upload_at' => 'datetime',
'external_updated_at' => 'datetime',
'updated_need' => 'datetime',
'reserve_create_at' => 'datetime',
'reserve_update_at' => 'datetime',
];
public $incrementing = true;
static public function getWithPivot()
{
return [
'id',
'external_id',
'goal_ad_group_external_id',
'dictionary_campaign_external_id',
'goal_ad_group_id',
'dictionary_campaign_id',
'bid_modifier_id',
'level',
'type',
'mobile_adjustment',
'desktop_adjustment',
'demographics_adjustment',
'retargeting_adjustment',
'external_upload_at',
'external_updated_at',
'updated_need',
'reserve_create_at',
'reserve_update_at',
];
}
/**
* @param Builder $query
* @return Builder
*/
public function scopeForExternal($query)
{
return $query->whereNotNull('external_id');
}
/**
* @param Builder $query
* @return Builder
*/
public function scopeForNotExternal($query)
{
return $query->whereNull('external_id');
}
/**
* @param Builder $query
* @return Builder
*/
public function scopeForNotReserveCreate($query)
{
return $query->whereNull('reserve_create_at');
}
/**
* @param Builder $query
* @return Builder
*/
public function scopeNeedUpdated($query)
{
return $query->whereNotNull('updated_need');
}
public function bidModifier()
{
return $this->belongsTo(BidModifier::class, 'bid_modifier_id');
}
public function dictionaryCampaign()
{
return $this->belongsTo(DictionaryCampaign::class, 'dictionary_campaign_id');
}
}