12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
-
- namespace App\Http\Controller;
-
- use App\Http\Business\CommandTypesBusiness;
- use Luticate\Utils\LuController;
- use App\Http\Business\CommandsBusiness;
- use App\Http\DBO\CommandsDbo;
- use Luticate\Utils\LuMultipleDbo;
-
- class CommandsController extends LuController {
- protected function getBusiness()
- {
- return new CommandsBusiness();
- }
-
- /**
- * Get all command types
- * @param int $page The page number, 0 based
- * @param int $perPage The number of items per page
- * @param string $query The filter query
- * @return LuMultipleDbo
- */
- public function getAllTypes($page = 0, $perPage = PHP_INT_MAX, $query = "")
- {
- return CommandTypesBusiness::getAll($page, $perPage, $query);
- }
-
- /**
- * Get all commands, sorted by name
- * @param int $page The page number, 0 based
- * @param int $perPage The number of items per page
- * @param string $query The filter query
- * @return \Luticate\Utils\LuMultipleDbo
- */
- public function getAll($page = 0, $perPage = PHP_INT_MAX, $query = "")
- {
- return CommandsBusiness::getAll($page, $perPage, $query);
- }
-
- /**
- * Get a command
- * @param $command_id int The command id
- * @return CommandsDbo
- */
- public function get($command_id)
- {
- return CommandsBusiness::getById($command_id);
- }
-
- /**
- * Add a new command
- * @param CommandsDbo $command The command
- * @return int
- */
- public function add(CommandsDbo $command)
- {
- return CommandsBusiness::add($command);
- }
-
- /**
- * Edit an existing command
- * @param CommandsDbo $command The command
- * @param $command_id int The command id
- * @return bool
- */
- public function edit(CommandsDbo $command, $command_id)
- {
- return CommandsBusiness::edit($command, $command_id);
- }
-
- /**
- * Delete an existing command
- * @param $command_id int The command id
- * @return bool
- */
- public function del($command_id)
- {
- return CommandsBusiness::deleteById($command_id);
- }
-
- /**
- * Execute a command
- * @param $command_id int The command id
- * @return mixed
- */
- public function exec($command_id)
- {
- return CommandsBusiness::exec($command_id);
- }
- }
|