<?php namespace App\Repositories; use App\Models\CompanyTpl; use Prettus\Repository\Eloquent\BaseRepository; /** * Class CompanyStatisticsRepositoryEloquent. * * @package namespace App\Repositories; */ class CompanyTplRepository extends BaseRepository { /** * Specify Model class name * * @return string */ public function model() { return CompanyTpl::class; } public function getTplByUid($where) { return $this->model->whereHas('tpls',function ($query){ $query->where(['tpl_type'=>1]); })->with('tpls')->where($where)->get(); } public function getTpl($where) { return $this->model->where($where)->first(); } public function createTpl($data) { return $this->model->create($data); } }