| 1 |
<?php |
| 2 |
|
| 3 |
namespace ReviewX\Rest\Controllers; |
| 4 |
|
| 5 |
\defined("ABSPATH") || exit; |
| 6 |
use ReviewX\Services\CategoryService; |
| 7 |
use ReviewX\Utilities\Helper; |
| 8 |
use ReviewX\WPDrill\Contracts\InvokableContract; |
| 9 |
use ReviewX\WPDrill\Response; |
| 10 |
class CategoryController implements InvokableContract |
| 11 |
{ |
| 12 |
protected $categoryService; |
| 13 |
/** |
| 14 |
* @param CategoryService $categoryService |
| 15 |
*/ |
| 16 |
public function __construct(CategoryService $categoryService) |
| 17 |
{ |
| 18 |
$this->categoryService = $categoryService; |
| 19 |
} |
| 20 |
/** |
| 21 |
* @return void |
| 22 |
*/ |
| 23 |
public function __invoke() |
| 24 |
{ |
| 25 |
} |
| 26 |
/** |
| 27 |
* @return Response |
| 28 |
*/ |
| 29 |
public function selectable() |
| 30 |
{ |
| 31 |
$resp = $this->categoryService->selectable(); |
| 32 |
return Helper::getApiResponse($resp); |
| 33 |
} |
| 34 |
/** |
| 35 |
* @return Response |
| 36 |
*/ |
| 37 |
public function getCategory() |
| 38 |
{ |
| 39 |
$resp = $this->categoryService->getCategory(); |
| 40 |
return Helper::getApiResponse($resp); |
| 41 |
} |
| 42 |
/** |
| 43 |
* @return Response |
| 44 |
*/ |
| 45 |
public function getCategoryAll() |
| 46 |
{ |
| 47 |
$resp = $this->categoryService->getCategoryAll(); |
| 48 |
return Helper::getApiResponse($resp); |
| 49 |
} |
| 50 |
/** |
| 51 |
* @return Response |
| 52 |
*/ |
| 53 |
public function storeCategory($request) |
| 54 |
{ |
| 55 |
$resp = $this->categoryService->storeCategory($request->get_params()); |
| 56 |
return Helper::getApiResponse($resp); |
| 57 |
} |
| 58 |
} |
| 59 |
|