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 581e390a
authored
Nov 16, 2021
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix cascade delete
1 parent
8203a60f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
app/Http/Controllers/TokensController.php
database/migrations/2021_05_11_084828_create_campaigns_table.php
app/Http/Controllers/TokensController.php
View file @
581e390
...
...
@@ -191,7 +191,9 @@ class TokensController extends Controller
public
function
destroy
(
Tokens
$token
)
{
$token
->
campaigns
()
->
delete
();
$token
->
cities
()
->
update
([
'token_id'
=>
null
,
]);
$token
->
delete
();
return
Redirect
::
route
(
'tokens'
)
->
with
(
'success'
,
'Token deleted.'
);
...
...
database/migrations/2021_05_11_084828_create_campaigns_table.php
View file @
581e390
...
...
@@ -37,7 +37,8 @@ class CreateCampaignsTable extends Migration
$table
->
timestamp
(
'disabled_at'
)
->
nullable
();
$table
->
timestamps
();
$table
->
foreign
(
'token'
)
->
references
(
'id'
)
->
on
(
'tokens'
);
$table
->
foreign
(
'token'
)
->
references
(
'id'
)
->
on
(
'tokens'
)
->
cascadeOnDelete
();
});
}
...
...
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