Commit d001fdbc by Vladislav

#19459 Вывод для основного аккаунта списка его РК из кеша

1 parent 0f2d6b16
......@@ -40,8 +40,8 @@ class TokensController extends Controller
'token' => $token->token,
'type' => $token->type,
'campaigns' => (
$token->type==Tokens::MAIN
? $token->campaigns
$token->type === Tokens::MAIN
? $token->campaignsForManaged
: null
),
'cities' => ($token->type==Tokens::GOAL?[]:null),
......
......@@ -28,8 +28,18 @@ class Campaigns extends Model
'updated'
];
protected $casts = [
'manage' => 'boolean',
'enabled' => 'boolean',
];
public function scopeForUpdated($query)
{
$query->whereNotNull('updated');
}
public function scopeForManaged($query)
{
$query->where('manage', true);
}
}
......@@ -32,4 +32,9 @@ class Tokens extends Model
{
return $this->hasMany(Campaigns::class, 'token', 'id')->orderBy('updated_at', 'DESC');
}
public function campaignsForManaged()
{
return $this->campaigns()->forManaged();
}
}
......@@ -50,7 +50,7 @@
{{ campaign.name }}
</td>
<td class="border-t py-3">
<input :id="'campaign-enabled-' + campaign.id" type="checkbox">
<input :id="'campaign-enabled-' + campaign.id" :checked="campaign.enabled" type="checkbox">
<label :for="'campaign-enabled-' + campaign.id">Enabled</label>
<button class="text-red-600 hover:underline"
tabindex="-1"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!