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