Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Письменов Дмитрий Иванович
/
yourroomads
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9eef61e4
authored
Sep 23, 2021
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#20794 Сделать чтобы в целевых РК оставалась одна карточка
1 parent
dac47d01
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletions
app/Models/Advertisement.php
app/Models/Pivots/GoalAdvertisement.php
app/Service/Requests/Direct/GetAds.php
app/Models/Advertisement.php
View file @
9eef61e
...
...
@@ -105,6 +105,7 @@ class Advertisement extends Model
'reserve_delete_at'
,
'deleted_at'
,
'updated_at'
,
];
protected
$casts
=
[
...
...
app/Models/Pivots/GoalAdvertisement.php
View file @
9eef61e
...
...
@@ -222,7 +222,13 @@ class GoalAdvertisement extends Pivot
public
function
scopeNeedDeleted
(
$query
)
{
return
$query
->
where
(
function
(
Builder
$query
)
{
return
$query
->
whereNotNull
(
'deleted_need'
);
return
$query
->
whereNotNull
(
'deleted_need'
)
->
orWhere
(
function
(
Builder
$query
)
{
return
$query
->
whereExists
(
function
(
\Illuminate\Database\Query\Builder
$query
)
{
$query
->
select
(
DB
::
raw
(
1
))
->
from
(
'advertisements'
)
->
whereNotNull
(
'advertisements.deleted_at'
)
->
whereColumn
(
'goal_advertisements.advertisement_id'
,
'advertisements.id'
);
});
})
->
orWhere
(
function
(
Builder
$query
)
{
return
$query
->
whereExists
(
function
(
\Illuminate\Database\Query\Builder
$query
)
{
$query
->
select
(
DB
::
raw
(
1
))
...
...
@@ -234,6 +240,7 @@ class GoalAdvertisement extends Pivot
->
whereColumn
(
'goal_advertisements.goal_ad_group_id'
,
'goal_ad_groups.id'
);
});
});
})
->
whereNull
(
'goal_advertisements.deleted_at'
);
}
/**
...
...
app/Service/Requests/Direct/GetAds.php
View file @
9eef61e
...
...
@@ -130,6 +130,7 @@ class GetAds extends DirectRequest
'business_id'
=>
$ad
[
'TextAd'
][
'BusinessId'
],
'prefer_v_card_over_business'
=>
isset
(
$ad
[
'TextAd'
][
'PreferVCardOverBusiness'
])
?
$ad
[
'TextAd'
][
'PreferVCardOverBusiness'
]
===
'YES'
:
null
,
'deleted_at'
=>
null
,
'updated_at'
=>
Carbon
::
now
(),
]);
$ad_extensions_array
=
[];
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment