12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
-
- namespace App\Http\DataAccess;
-
- use Luticate\Utils\LuDataAccess;
- use App\Http\DataAccess\Models\Cameras;
- use App\Http\DBO\CamerasDbo;
-
- class CamerasDataAccess extends LuDataAccess {
- protected static function getModel()
- {
- return new Cameras();
- }
-
- 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 CamerasDbo|null
- */
- public static function getByName($name)
- {
- $camera = Cameras::where("name", "=", $name)->first();
- if (is_null($camera)) {
- return null;
- }
- return $camera->toDbo();
- }
- }
|