Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

CommandsController.php 2.4KB

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