We have already developed part of the code needed for this function, but we will rewrite part of it because, in the meantime, we have made changes to the database that will affect the functionality of our application. What we are going to develop next is similar to the previous CRUD sections. Let's start with the API controller.
As we did in Chapter 7, The Backoffice Module (Part 1), with hashtag and category, we will need to create a controller for the user. Create a new file in modules/Api/Controller/
and name it UsersController.php
. Then, write the following code:
<?php namespace App\Api\Controllers; class UsersController extends BaseController{ public function updateAction($id) { try { $manager = $this->getDI()->get('core_user_manager'); if ($this->request->getHeader('CONTENT_TYPE') == 'application/json') { $data = $this->request->getJsonRawBody(true); } else { $data = $this->request...