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 4d985798
authored
Aug 17, 2022
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix initial token CampaignsFirstLoad
1 parent
04872519
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
app/Http/Controllers/TokensController.php
app/Models/Tokens.php
app/Http/Controllers/TokensController.php
View file @
4d98579
...
...
@@ -203,6 +203,9 @@ class TokensController extends Controller
'allow_retargeting_load'
=>
[
'nullable'
,
'boolean'
],
])
);
if
(
$token
->
isMain
())
{
Artisan
::
call
(
CampaignsFirstLoad
::
class
);
}
}
else
{
$token
->
update
(
Request
::
validate
([
...
...
@@ -212,10 +215,6 @@ class TokensController extends Controller
);
}
if
(
$token
->
isMain
())
{
Artisan
::
call
(
CampaignsFirstLoad
::
class
);
}
return
Redirect
::
back
()
->
with
(
'success'
,
'Token updated.'
);
}
...
...
app/Models/Tokens.php
View file @
4d98579
...
...
@@ -11,6 +11,7 @@ use App\Models\Pivots\GoalSitelink;
use
Carbon\Carbon
;
use
Illuminate\Database\Eloquent\Builder
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Support\Facades\DB
;
/**
* App\Models\Tokens
...
...
@@ -158,7 +159,15 @@ class Tokens extends Model
*/
public
function
scopeAllowedLimit
(
$query
)
{
return
$query
->
whereColumn
(
'limit_to_run'
,
'<'
,
'limit'
);
return
$query
->
where
(
function
(
$query
)
{
$query
->
whereColumn
(
'limit_to_run'
,
'<'
,
'limit'
)
->
orWhere
(
function
(
$query
)
{
$query
->
whereNotExists
(
function
(
$query
)
{
$query
->
select
(
DB
::
raw
(
1
))
->
from
(
'limits'
)
->
whereColumn
(
'limits.token'
,
'tokens.id'
);
});
});
});
}
/**
...
...
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