You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HostsDataAccess.php 777B

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