You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HostsController.php 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace App\Http\Controller;
  3. use Luticate\Utils\LuController;
  4. use App\Http\Business\HostsBusiness;
  5. use App\Http\DBO\HostsDbo;
  6. class HostsController extends LuController {
  7. protected function getBusiness()
  8. {
  9. return new HostsBusiness();
  10. }
  11. /**
  12. * Get all hosts, sorted by name
  13. * @param int $page The page number, 0 based
  14. * @param int $perPage The number of items per page
  15. * @param string $query The filter query
  16. * @return \Luticate\Utils\LuMultipleDbo
  17. */
  18. public function getAll($page = 0, $perPage = PHP_INT_MAX, $query = "")
  19. {
  20. return HostsBusiness::getAll($page, $perPage, $query);
  21. }
  22. /**
  23. * Get a host
  24. * @param $host_id int The host id
  25. * @return HostsDbo
  26. */
  27. public function get($host_id)
  28. {
  29. return HostsBusiness::getById($host_id);
  30. }
  31. /**
  32. * Add a new host
  33. * @param HostsDbo $host The host
  34. * @return int
  35. */
  36. public function add(HostsDbo $host)
  37. {
  38. return HostsBusiness::add($host);
  39. }
  40. /**
  41. * Edit an existing host
  42. * @param HostsDbo $host The host
  43. * @param $host_id int The host id
  44. * @return bool
  45. */
  46. public function edit(HostsDbo $host, $host_id)
  47. {
  48. return HostsBusiness::edit($host, $host_id);
  49. }
  50. /**
  51. * Delete an existing host
  52. * @param $host_id int The host id
  53. * @return bool
  54. */
  55. public function del($host_id)
  56. {
  57. return HostsBusiness::del($host_id);
  58. }
  59. }