<?php

namespace App\Repositories;

use App\Models\Hrtools;
use Prettus\Repository\Eloquent\BaseRepository;

/**
 * Class HrtoolsRepositoryEloquent.
 *
 * @package namespace App\Repositories;
 */
class HrtoolsRepository extends BaseRepository
{
    /**
     * Specify Model class name
     *
     * @return string
     */
    public function model()
    {
        return Hrtools::class;
    }
    public function getLists($where)
    {
        $res = $this->model->where($where)->orderBy('list_order', 'desc')->orderBy('created_at', 'desc')->get();
        if ($res->toArray()) {
            foreach ($res as $k => $v) {
                if ($v->tit_b=="1") {
                    $res[$k]->title ="<strong>".$v->tit_b."</strong>";
                }
                if ($v->tit_color != '#000000') {
                    //$res[$k]->title="<span style=\"color:{{$v->tit_color}}\">".$res[$k]->title."</span>";
                    $res[$k]->title='<span style="color:'.$v->tit_color.';">'.$res[$k]->title.'</span>';
                }
                $res[$k]->file_url = substr($v->file_url, 0, 7)=="http://"?$v->file_url:upload_asset($v->file_url);
            }
        }
         return $res;
    }


}