Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Yashvant Singh
/
laravel--
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
alexeymezenin
2022-12-26 22:50:48 +1030
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2022-12-26 22:50:48 +1030
Commit
de3ca03b5f1e52af985bee0b5a191baa85496c67
de3ca03b
1 parent
dbad4b95
Reused code
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
app/Http/Controllers/ArticleController.php
app/Http/Controllers/ArticleController.php
View file @
de3ca03
...
...
@@ -45,7 +45,7 @@ class ArticleController extends Controller
{
$article
=
auth
()
->
user
()
->
articles
()
->
create
(
$request
->
validated
()[
'article'
]);
$this
->
articleService
->
syncTags
(
$article
,
$request
->
validated
()[
'article'
][
'tagList'
]
??
[]
);
$this
->
syncTags
(
$article
);
return
$this
->
articleResponse
(
$article
);
}
...
...
@@ -54,7 +54,7 @@ class ArticleController extends Controller
{
$article
->
update
(
$request
->
validated
()[
'article'
]);
$this
->
articleService
->
syncTags
(
$article
,
$request
->
validated
()[
'article'
][
'tagList'
]
??
[]
);
$this
->
syncTags
(
$article
);
return
$this
->
articleResponse
(
$article
);
}
...
...
@@ -77,6 +77,11 @@ class ArticleController extends Controller
return
$this
->
articleResponse
(
$article
);
}
protected
function
syncTags
(
Article
$article
)
:
void
{
$this
->
articleService
->
syncTags
(
$article
,
$this
->
request
->
validated
()[
'article'
][
'tagList'
]
??
[]);
}
protected
function
articleResponse
(
Article
$article
)
:
ArticleResource
{
...
...
Please
register
or
login
to post a comment