In the model, you can create methods that have database queries and are responsible for data processing. You have to remember to install dframe/database package before starting work. It's available on GITHUB or through the composer.
In folder "Model" you must model named "RequestModel" should look like Models/RequestModel.php
/** @var \Model\RequestModel $requestModel */
$requestModel = $this->loadModel('RequestModel');
Models/RequestModel.php
namespace Model;
class RequestModel extends \Model\Model
{
/**
* @param int $requestId
* @return mixed
*/
public function getRequestSettings($requestId)
{
$row = $this->pdoQuery('SELECT * FROM `request_type` WHERE request_type_id = ?', [$requestId])->result();
return $this->methodResult(true, $row);
}
}
Notice that virtually all methods, except for a few, return the data in the form of a ready to read table and are returned by the method.
/**
* @param boolean
* @param array
*/
$this->methodResult(true, $row);
Edit page (Model/overview)