1: | <?php |
2: | |
3: | namespace CHEZ14\ApiKit\Controllers; |
4: | |
5: | use App\Controllers\BaseController; |
6: | use CHEZ14\ApiKit\Exceptions\ApiException; |
7: | use CodeIgniter\API\ResponseTrait; |
8: | |
9: | class DumbController extends BaseController |
10: | { |
11: | use ResponseTrait; |
12: | |
13: | |
14: | |
15: | |
16: | |
17: | |
18: | |
19: | public function throwError(ApiException $e) |
20: | { |
21: | $data = [ |
22: | "status" => false, |
23: | "message" => $e->getMessage(), |
24: | "data" => null |
25: | ]; |
26: | |
27: | |
28: | |
29: | $this->respond($data, $e->getHttpCode())->send(); |
30: | } |
31: | } |
32: | |