GoalAdvertisement.php
3.92 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
<?php
namespace App\Models\Pivots;
use App\Models\Advertisement;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* App\Models\Pivots\GoalAdvertisement
*
* @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 $advertisement_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 Advertisement $advertisement
* @method static Builder|GoalAdvertisement forExternal()
* @method static Builder|GoalAdvertisement forNotExternal()
* @method static Builder|GoalAdvertisement needUpdated()
* @method static Builder|GoalAdvertisement newModelQuery()
* @method static Builder|GoalAdvertisement newQuery()
* @method static Builder|GoalAdvertisement query()
* @method static Builder|GoalAdvertisement whereCreatedAt($value)
* @method static Builder|GoalAdvertisement whereDictionaryCampaignExternalId($value)
* @method static Builder|GoalAdvertisement whereDictionaryCampaignId($value)
* @method static Builder|GoalAdvertisement whereExternalId($value)
* @method static Builder|GoalAdvertisement whereExternalUpdatedAt($value)
* @method static Builder|GoalAdvertisement whereExternalUploadAt($value)
* @method static Builder|GoalAdvertisement whereGoalAdGroupExternalId($value)
* @method static Builder|GoalAdvertisement whereGoalAdGroupId($value)
* @method static Builder|GoalAdvertisement whereId($value)
* @method static Builder|GoalAdvertisement whereAdvertisementId($value)
* @method static Builder|GoalAdvertisement whereUpdatedAt($value)
* @method static Builder|GoalAdvertisement whereUpdatedNeed($value)
* @mixin \Eloquent
*/
class GoalAdvertisement extends Pivot
{
use SoftDeletes;
protected $table = 'goal_advertisements';
protected $fillable = [
'external_id',
'goal_ad_group_external_id',
'dictionary_campaign_external_id',
'goal_ad_group_id',
'dictionary_campaign_id',
'advertisement_id',
'external_upload_at',
'external_updated_at',
'updated_need',
'reserve_create_at',
];
protected $casts = [
'external_upload_at' => 'datetime',
'external_updated_at' => 'datetime',
'updated_need' => 'datetime',
'reserve_create_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',
'advertisement_id',
'external_upload_at',
'external_updated_at',
'updated_need',
];
}
/**
* @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 scopeNeedUpdated($query)
{
return $query->whereNotNull('updated_need');
}
public function advertisement()
{
return $this->belongsTo(Advertisement::class, 'advertisement_id');
}
public function dictionaryCampaign()
{
return $this->belongsTo(DictionaryCampaign::class, 'dictionary_campaign_id');
}
}