| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 | <?php
namespace App\Http\Controller;
use App\Http\Business\CommandTypesBusiness;
use Luticate\Auth\DBO\LuticateUsersDbo;
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
     * @param $_user LuticateUsersDbo
     * @return LuMultipleDbo
     */
    public function getAll($_user, $page = 0, $perPage = PHP_INT_MAX, $query = "")
    {
        return CommandsBusiness::getAllLight($_user, $page, $perPage, $query);
    }
    /**
     * Get a command
     * @param $command_id int The command id
     * @param $_user LuticateUsersDbo Injected parameter
     * @return CommandsDbo
     */
    public function get($_user, $command_id)
    {
        return CommandsBusiness::getLight($_user, $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);
    }
}
 |