/
collections.php
32 lines (29 loc) · 1.05 KB
/
collections.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
// Collections
$router->group([
'namespace' => 'Collections',
'prefix' => 'collections',
'middleware' => ['scope:collections, sets, expiration']
], function () use ($router) {
// Public access
resource($router, '/', 'CollectionsController', [
'only' => ['index', 'show']
]);
$router->group(['prefix' => '/{set_id:[0-9]+}/posts'], function () use ($router) {
$router->get('/', 'PostsController@index');
$router->get('/{id}', 'PostsController@show');
});
// Restricted access
$router->group([
'middleware' => ['auth:api']
], function () use ($router) {
resource($router, '/', 'CollectionsController', [
'only' => ['store', 'update', 'destroy']
]);
$router->group(['prefix' => '/{set_id:[0-9]+}/posts'], function () use ($router) {
$router->post('/', 'PostsController@store');
//$router->put('/{id}', 'PostsController@update');
$router->delete('/{id}', 'PostsController@destroy');
});
});
});