12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
-
- namespace App\Http\DataAccess;
-
- use Luticate\Utils\LuDataAccess;
- use App\Http\DataAccess\Models\Commands;
- use App\Http\DBO\CommandsDbo;
-
- class CommandsDataAccess extends LuDataAccess {
- protected static function getModel()
- {
- return new Commands();
- }
-
- protected static function getOrderBy()
- {
- return array(array("name", "ASC"));
- }
-
- protected static function getQueryPredicate($query)
- {
- return array(
- array("name", "ilike", "%" . $query . "%", "or"),
- array("description", "ilike", "%" . $query . "%", "or")
- );
- }
-
- /**
- * @param $name
- * @return CommandsDbo|null
- */
- public static function getByName($name)
- {
- $sensor = Commands::where("name", "=", $name)->first();
- if (is_null($sensor)) {
- return null;
- }
- return $sensor->toDbo();
- }
- }
|