Commit d1b34babc0dbb5bcc126ad9389dc3bd2a64a95ae
1 parent
523e0021
test
Showing
1 changed file
with
18 additions
and
6 deletions
Show diff stats
app/library/App/Resources/ProjectResource.php
| @@ -26,17 +26,28 @@ class ProjectResource extends ApiResource { | @@ -26,17 +26,28 @@ class ProjectResource extends ApiResource { | ||
| 26 | ->name('Project') | 26 | ->name('Project') |
| 27 | ->model(Project::class) | 27 | ->model(Project::class) |
| 28 | ->expectsJsonData() | 28 | ->expectsJsonData() |
| 29 | - ->transformer(ProjectTransformer::class) | ||
| 30 | - ->handler(ProjectController::class) | ||
| 31 | - ->handler(CrudResourceController::class) | ||
| 32 | - ->itemKey('projects') | 29 | + ->itemKey('project') |
| 33 | ->collectionKey('projects') | 30 | ->collectionKey('projects') |
| 34 | - ->allow(AclRoles::AUTHORIZED) | 31 | + ; |
| 32 | + | ||
| 33 | + /** transformers **/ | ||
| 34 | + $this | ||
| 35 | + ->transformer(ProjectTransformer::class); | ||
| 36 | + | ||
| 37 | + /** handlers **/ | ||
| 38 | + $this | ||
| 39 | + ->handler(ProjectController::class) | ||
| 40 | + ->handler(CrudResourceController::class); | ||
| 41 | + | ||
| 42 | + /** general roles **/ | ||
| 43 | + $this | ||
| 44 | + ->allow(AclRoles::AUTHORIZED); | ||
| 35 | 45 | ||
| 46 | + /** endpoints **/ | ||
| 47 | + $this | ||
| 36 | ->endpoint(ApiEndpoint::post('/test', 'test') | 48 | ->endpoint(ApiEndpoint::post('/test', 'test') |
| 37 | ->description('Returns the currently logged in user') | 49 | ->description('Returns the currently logged in user') |
| 38 | ) | 50 | ) |
| 39 | - | ||
| 40 | ->endpoint(ApiEndpoint::all()) | 51 | ->endpoint(ApiEndpoint::all()) |
| 41 | ->endpoint(ApiEndpoint::create()) | 52 | ->endpoint(ApiEndpoint::create()) |
| 42 | ->endpoint(ApiEndpoint::find()) | 53 | ->endpoint(ApiEndpoint::find()) |
| @@ -44,6 +55,7 @@ class ProjectResource extends ApiResource { | @@ -44,6 +55,7 @@ class ProjectResource extends ApiResource { | ||
| 44 | ->endpoint(ApiEndpoint::remove()) | 55 | ->endpoint(ApiEndpoint::remove()) |
| 45 | ; | 56 | ; |
| 46 | 57 | ||
| 58 | + | ||
| 47 | } | 59 | } |
| 48 | 60 | ||
| 49 | } | 61 | } |
| 50 | \ No newline at end of file | 62 | \ No newline at end of file |