diff --git a/app/library/App/Model/Project.php b/app/library/App/Model/Project.php new file mode 100644 index 0000000..b3611fc --- /dev/null +++ b/app/library/App/Model/Project.php @@ -0,0 +1,31 @@ + 'id', + 'name' => 'name', + 'user_id' => 'user_id' + ]; + } + + public function initialize() { + + $this->belongsTo('user_id', User::class, 'id', [ + 'alias' => 'User', + ]); + } +} diff --git a/app/library/App/Resources/ProjectResource.php b/app/library/App/Resources/ProjectResource.php new file mode 100644 index 0000000..887143f --- /dev/null +++ b/app/library/App/Resources/ProjectResource.php @@ -0,0 +1,39 @@ +name('Project') + ->model(Project::class) + ->expectsJsonData() + ->transformer(ModelTransformer::class) + ->itemKey('project') + ->collectionKey('projects') + ->deny(AclRoles::UNAUTHORIZED) + ->handler(CrudResourceController::class) + + ->endpoint(ApiEndpoint::all()) + ->endpoint(ApiEndpoint::create()) + ->endpoint(ApiEndpoint::find()) + ->endpoint(ApiEndpoint::update()) + ->endpoint(ApiEndpoint::remove()); + } + +} \ No newline at end of file -- libgit2 0.21.4