Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
ff63ddc5
Unverified
Commit
ff63ddc5
authored
Sep 14, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding route to update a page
parent
511b2984
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
PageController.php
Modules/Page/Http/Controllers/Api/PageController.php
+11
-1
apiRoutes.php
Modules/Page/Http/apiRoutes.php
+5
-0
No files found.
Modules/Page/Http/Controllers/Api/PageController.php
View file @
ff63ddc5
...
...
@@ -2,10 +2,10 @@
namespace
Modules\Page\Http\Controllers\Api
;
use
Illuminate\Http\Request
;
use
Illuminate\Routing\Controller
;
use
Modules\Page\Entities\Page
;
use
Modules\Page\Http\Requests\CreatePageRequest
;
use
Modules\Page\Http\Requests\UpdatePageRequest
;
use
Modules\Page\Repositories\PageRepository
;
use
Modules\Page\Transformers\FullPageTransformer
;
use
Modules\Page\Transformers\PageTransformer
;
...
...
@@ -42,6 +42,16 @@ class PageController extends Controller
return
new
FullPageTransformer
(
$page
);
}
public
function
update
(
Page
$page
,
UpdatePageRequest
$request
)
{
$this
->
page
->
update
(
$page
,
$request
->
all
());
return
response
()
->
json
([
'errors'
=>
false
,
'message'
=>
trans
(
'page::messages.page updated'
),
]);
}
public
function
destroy
(
Page
$page
)
{
$this
->
page
->
destroy
(
$page
);
...
...
Modules/Page/Http/apiRoutes.php
View file @
ff63ddc5
...
...
@@ -28,5 +28,10 @@ $router->group(['prefix' => '/page'], function (Router $router) {
'uses'
=>
'PageController@find'
,
'middleware'
=>
'token-can:page.pages.edit'
,
]);
$router
->
post
(
'pages/{page}/edit'
,
[
'as'
=>
'api.page.page.update'
,
'uses'
=>
'PageController@update'
,
'middleware'
=>
'token-can:page.pages.edit'
,
]);
$router
->
get
(
'templates'
,
'PageTemplatesController'
)
->
name
(
'api.page.page-templates.index'
);
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment