name('Project') ->model(Project::class) ->expectsJsonData() ->transformer(ModelTransformer::class) ->itemKey('project') ->collectionKey('projects') ->deny(AclRoles::ALL_ROLES) ->handler(ProjectController::class) /** -------------------- [GET] projects ----------------------------- **/ ->endpoint(ApiEndpoint::factory('/', HttpMethods::GET, 'allAction') ->name(ApiEndpoint::ALL) ->description('Returns all items') ->allow( AclRoles::ADMINISTRATOR, AclRoles::USER, AclRoles::EDITOR, AclRoles::AUTHOR ) ) /** ----------------------------------------------------------------- **/ /** -------------------- [POST] projects ---------------------------- **/ ->endpoint(ApiEndpoint::factory('/', HttpMethods::POST, 'create') ->name(ApiEndpoint::CREATE) ->description('Creates a new item using the posted data') ->allow( AclRoles::ADMINISTRATOR, AclRoles::USER ) ) /** ----------------------------------------------------------------- **/ /** -------------------- [GET] projects/{id} ------------------------ **/ ->endpoint(ApiEndpoint::find() ->allow(AclRoles::ADMINISTRATOR) ) /** ----------------------------------------------------------------- **/ /** -------------------- [PUT] projects/{id} ------------------------ **/ ->endpoint(ApiEndpoint::factory('/{id}', HttpMethods::PUT, 'update') ->name(ApiEndpoint::UPDATE) ->description('Updates an existing item identified by {id}, using the posted data') ->allow( AclRoles::ADMINISTRATOR, AclRoles::USER ) ) /** ----------------------------------------------------------------- **/ /** -------------------- [DELETE] projects/{id} --------------------- **/ ->endpoint(ApiEndpoint::factory('/{id}', HttpMethods::DELETE, 'remove') ->name(ApiEndpoint::REMOVE) ->description('Removes the item identified by {id}') ->allow( AclRoles::ADMINISTRATOR, AclRoles::USER ) ); /** ----------------------------------------------------------------- **/ } }