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
4922747b
Unverified
Commit
4922747b
authored
Sep 10, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Creating api routes for Page resource
parent
68a2cb6c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
1 deletion
+47
-1
PageController.php
Modules/Page/Http/Controllers/Api/PageController.php
+30
-0
apiRoutes.php
Modules/Page/Http/apiRoutes.php
+16
-0
RouteServiceProvider.php
Modules/Page/Providers/RouteServiceProvider.php
+1
-1
No files found.
Modules/Page/Http/Controllers/Api/PageController.php
0 → 100644
View file @
4922747b
<?php
namespace
Modules\Page\Http\Controllers\Api
;
use
Illuminate\Routing\Controller
;
use
Modules\Page\Entities\Page
;
use
Modules\Page\Repositories\PageRepository
;
class
PageController
extends
Controller
{
/**
* @var PageRepository
*/
private
$page
;
public
function
__construct
(
PageRepository
$page
)
{
$this
->
page
=
$page
;
}
public
function
destroy
(
$page
)
{
$this
->
page
->
destroy
(
$page
);
return
response
()
->
json
([
'errors'
=>
false
,
'message'
=>
trans
(
'page::messages.page deleted'
),
]);
}
}
Modules/Page/Http/apiRoutes.php
0 → 100644
View file @
4922747b
<?php
use
Illuminate\Routing\Router
;
/** @var Router $router */
$router
->
bind
(
'page'
,
function
(
$id
)
{
return
app
(
\Modules\Page\Repositories\PageRepository
::
class
)
->
find
(
$id
);
});
$router
->
group
([
'prefix'
=>
'/page'
],
function
(
Router
$router
)
{
$router
->
delete
(
'pages/{page}'
,
[
'as'
=>
'api.page.page.destroy'
,
'uses'
=>
'PageController@destroy'
,
'middleware'
=>
'token-can:page.pages.destroy'
,
]);
});
Modules/Page/Providers/RouteServiceProvider.php
View file @
4922747b
...
...
@@ -33,6 +33,6 @@ class RouteServiceProvider extends CoreRoutingServiceProvider
*/
protected
function
getApiRoute
()
{
return
false
;
return
__DIR__
.
'/../Http/apiRoutes.php'
;
}
}
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