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.

CommandsController.php 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. namespace App\Http\Controller;
  3. use App\Http\Business\CommandTypesBusiness;
  4. use Luticate\Utils\LuController;
  5. use App\Http\Business\CommandsBusiness;
  6. use App\Http\DBO\CommandsDbo;
  7. use Luticate\Utils\LuMultipleDbo;
  8. class CommandsController extends LuController {
  9. protected function getBusiness()
  10. {
  11. return new CommandsBusiness();
  12. }
  13. /**
  14. * Get all command types
  15. * @param int $page The page number, 0 based
  16. * @param int $perPage The number of items per page
  17. * @param string $query The filter query
  18. * @return LuMultipleDbo
  19. */
  20. public function getAllTypes($page = 0, $perPage = PHP_INT_MAX, $query = "")
  21. {
  22. return CommandTypesBusiness::getAll($page, $perPage, $query);
  23. }
  24. /**
  25. * Get all commands, sorted by name
  26. * @param int $page The page number, 0 based
  27. * @param int $perPage The number of items per page
  28. * @param string $query The filter query
  29. * @return \Luticate\Utils\LuMultipleDbo
  30. */
  31. public function getAll($page = 0, $perPage = PHP_INT_MAX, $query = "")
  32. {
  33. return CommandsBusiness::getAll($page, $perPage, $query);
  34. }
  35. /**
  36. * Get a command
  37. * @param $command_id int The command id
  38. * @return CommandsDbo
  39. */
  40. public function get($command_id)
  41. {
  42. return CommandsBusiness::getById($command_id);
  43. }
  44. /**
  45. * Add a new command
  46. * @param CommandsDbo $command The command
  47. * @return int
  48. */
  49. public function add(CommandsDbo $command)
  50. {
  51. return CommandsBusiness::add($command);
  52. }
  53. /**
  54. * Edit an existing command
  55. * @param CommandsDbo $command The command
  56. * @param $command_id int The command id
  57. * @return bool
  58. */
  59. public function edit(CommandsDbo $command, $command_id)
  60. {
  61. return CommandsBusiness::edit($command, $command_id);
  62. }
  63. /**
  64. * Delete an existing command
  65. * @param $command_id int The command id
  66. * @return bool
  67. */
  68. public function del($command_id)
  69. {
  70. return CommandsBusiness::deleteById($command_id);
  71. }
  72. /**
  73. * Execute a command
  74. * @param $command_id int The command id
  75. * @return mixed
  76. */
  77. public function exec($command_id)
  78. {
  79. return CommandsBusiness::exec($command_id);
  80. }
  81. }