Commit a2321aea11803d925a6463c40b0501889439c123
1 parent
1e53f412
test
Showing
2 changed files
with
20 additions
and
4 deletions
Show diff stats
app/library/App/Controllers/ProjectController.php
| ... | ... | @@ -23,4 +23,21 @@ class ProjectController extends CrudResourceController { |
| 23 | 23 | |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | + public function find($id) | |
| 27 | + { | |
| 28 | + $item = $this->getFindData($id); | |
| 29 | + | |
| 30 | + if (!$item) { | |
| 31 | + return $this->onItemNotFound($id); | |
| 32 | + } | |
| 33 | + | |
| 34 | + if (!$this->findAllowed($id, $item)) { | |
| 35 | + return $this->onNotAllowed(); | |
| 36 | + } | |
| 37 | + | |
| 38 | + $response = $this->getFindResponse($item); | |
| 39 | + | |
| 40 | + return '123'; | |
| 41 | + } | |
| 42 | + | |
| 26 | 43 | } |
| 27 | 44 | \ No newline at end of file | ... | ... |
app/library/App/Resources/ProjectResource.php
| ... | ... | @@ -30,14 +30,13 @@ class ProjectResource extends ApiResource { |
| 30 | 30 | ->collectionKey('projects') |
| 31 | 31 | ; |
| 32 | 32 | |
| 33 | - /** transformers **/ | |
| 33 | + /** transformer **/ | |
| 34 | 34 | $this |
| 35 | 35 | ->transformer(ProjectTransformer::class); |
| 36 | 36 | |
| 37 | - /** handlers **/ | |
| 37 | + /** handler **/ | |
| 38 | 38 | $this |
| 39 | 39 | ->handler(ProjectController::class); |
| 40 | - //->handler(CrudResourceController::class); | |
| 41 | 40 | |
| 42 | 41 | /** general roles **/ |
| 43 | 42 | $this |
| ... | ... | @@ -46,7 +45,7 @@ class ProjectResource extends ApiResource { |
| 46 | 45 | /** endpoints **/ |
| 47 | 46 | $this |
| 48 | 47 | ->endpoint(ApiEndpoint::post('/test', 'test') |
| 49 | - ->description('Returns the currently logged in user') | |
| 48 | + ->description('Just for test') | |
| 50 | 49 | ) |
| 51 | 50 | ->endpoint(ApiEndpoint::all()) |
| 52 | 51 | ->endpoint(ApiEndpoint::create()) | ... | ... |