HrtoolsRepository.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace App\Repositories;
  3. use App\Models\Hrtools;
  4. use Prettus\Repository\Eloquent\BaseRepository;
  5. /**
  6. * Class HrtoolsRepositoryEloquent.
  7. *
  8. * @package namespace App\Repositories;
  9. */
  10. class HrtoolsRepository extends BaseRepository
  11. {
  12. /**
  13. * Specify Model class name
  14. *
  15. * @return string
  16. */
  17. public function model()
  18. {
  19. return Hrtools::class;
  20. }
  21. public function getLists($where)
  22. {
  23. $res = $this->model->where($where)->orderBy('list_order', 'desc')->orderBy('created_at', 'desc')->get();
  24. if ($res->toArray()) {
  25. foreach ($res as $k => $v) {
  26. if ($v->tit_b=="1") {
  27. $res[$k]->title ="<strong>".$v->tit_b."</strong>";
  28. }
  29. if ($v->tit_color != '#000000') {
  30. //$res[$k]->title="<span style=\"color:{{$v->tit_color}}\">".$res[$k]->title."</span>";
  31. $res[$k]->title='<span style="color:'.$v->tit_color.';">'.$res[$k]->title.'</span>';
  32. }
  33. $res[$k]->file_url = substr($v->file_url, 0, 7)=="http://"?$v->file_url:upload_asset($v->file_url);
  34. }
  35. }
  36. return $res;
  37. }
  38. }