Commit 895c22b969234ca0e9028c77a27b8e1fdbc4b409
1 parent
1c218e91
project entity
Showing
2 changed files
with
32 additions
and
4 deletions
Show diff stats
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Created by PhpStorm. | |
| 4 | + * User: Alex Savenko | |
| 5 | + * Date: 06.02.2017 | |
| 6 | + * Time: 19:06 | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace App\Controllers; | |
| 10 | + | |
| 11 | +use PhalconRest\Mvc\Controllers\CrudResourceController; | |
| 12 | + | |
| 13 | + | |
| 14 | +class ProjectController extends CrudResourceController { | |
| 15 | + | |
| 16 | + public function test() { | |
| 17 | + | |
| 18 | + return [ | |
| 19 | + 'te', | |
| 20 | + 's', | |
| 21 | + 't' | |
| 22 | + ]; | |
| 23 | + | |
| 24 | + } | |
| 25 | + | |
| 26 | +} | |
| 0 | 27 | \ No newline at end of file | ... | ... |
app/library/App/Resources/ProjectResource.php
| ... | ... | @@ -26,11 +26,13 @@ class ProjectResource extends ApiResource { |
| 26 | 26 | ->expectsJsonData() |
| 27 | 27 | ->transformer(ProjectTransformer::class) |
| 28 | 28 | ->handler(CrudResourceController::class) |
| 29 | - ->singleKey('project') | |
| 30 | - ->multipleKey('projects') | |
| 31 | - //->itemKey('project') | |
| 29 | + ->itemKey('projects') | |
| 32 | 30 | ->collectionKey('projects') |
| 33 | - ->allow(AclRoles::USER) | |
| 31 | + ->allow(AclRoles::AUTHORIZED) | |
| 32 | + | |
| 33 | + ->endpoint(ApiEndpoint::post('/test', 'test') | |
| 34 | + ->description('Returns the currently logged in user') | |
| 35 | + ) | |
| 34 | 36 | |
| 35 | 37 | ->endpoint(ApiEndpoint::all()) |
| 36 | 38 | ->endpoint(ApiEndpoint::create()) | ... | ... |