Commit 699628f3 by Vladislav

#19463 Реализация методов обработки полей РК с заменой переменных (исправление)

1 parent c3c8ed1f
......@@ -231,7 +231,8 @@ class TokensController extends Controller
return Redirect::back();
}
$city->token()->associate(null);
$city->token()->dissociate();
$city->save();
return Redirect::route('token.edit', $token->getKey())->with('success', 'City deleted.');
}
......
......@@ -45,8 +45,8 @@ class Campaigns extends Model
static::updated(function(Campaigns $campaign)
{
if ($campaign->enabled !== $campaign->getOriginal('enabled')) {
if ($campaign->enabled) {
if ($campaign->managed !== $campaign->getOriginal('managed')) {
if ($campaign->managed) {
Dictionary::whereNotNull('token_id')->each(function (Dictionary $dictionary) use ($campaign) {
$campaign->dictionaries()->syncWithoutDetaching([
$dictionary->getKey() => DictionaryCampaign::copyPropertyInCampaign($campaign),
......
......@@ -115,7 +115,9 @@ export default {
})
},
cityDelete(id) {
if (confirm('Are you sure you want to delete this city?')) {
this.$inertia.delete(this.route('token.city.destroy', [this.token.id, id]))
}
},
tokenUpdate() {
this.form.post(this.route('token.update', this.token.id))
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!