<?php namespace App\Repositories; use App\Models\HrtoolsCategory; use Prettus\Repository\Eloquent\BaseRepository; /** * Class HrtoolsCategoryRepositoryEloquent. * * @package namespace App\Repositories; */ class HrtoolsCategoryRepository extends BaseRepository { /** * Specify Model class name * * @return string */ public function model() { return HrtoolsCategory::class; } public function getLists($where) { $lists = $this->model->where($where)->orderBy('list_order', 'desc')->orderBy('created_at', 'desc')->get(); if ($lists->toArray()) { foreach ($lists as $k => $v) { if ($v->category_img) { $lists[$k]->category_img = upload_asset($v->category_img); } else { $lists[$k]->category_img = theme_asset('app/images/hrtools_img/'.$v->id.'.jpg'); } } } if (array_key_exists('id', $where)) { $lists = $lists[0]; } return $lists; } }