Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

SensorsDataAccess.php 892B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Http\DataAccess;
  3. use Luticate\Utils\LuDataAccess;
  4. use App\Http\DataAccess\Models\Sensors;
  5. use App\Http\DBO\SensorsDbo;
  6. class SensorsDataAccess extends LuDataAccess {
  7. protected static function getModel()
  8. {
  9. return new Sensors();
  10. }
  11. protected static function getOrderBy()
  12. {
  13. return array(array("name", "ASC"));
  14. }
  15. protected static function getQueryPredicate($query)
  16. {
  17. return array(
  18. array("name", "ilike", "%" . $query . "%", "or"),
  19. array("description", "ilike", "%" . $query . "%", "or")
  20. );
  21. }
  22. /**
  23. * @param $name
  24. * @return SensorsDbo|null
  25. */
  26. public static function getByName($name)
  27. {
  28. $sensor = Sensors::where("name", "=", $name)->first();
  29. if (is_null($sensor)) {
  30. return null;
  31. }
  32. return $sensor->toDbo();
  33. }
  34. }