1234567891011121314151617181920212223 |
- <?php
- namespace App\Repositories;
- use App\Maps\CacheMap;
- use App\Models\AdminMerchant;
- use Carbon\Carbon;
- use Illuminate\Support\Facades\Cache;
- class AdminMerchantRepository extends BaseRepository
- {
- public function __construct(AdminMerchant $model)
- {
- $this->model = $model;
- }
- public function byIdGetModel($id)
- {
- Cache::remember(CacheMap::DB . "AdminMerchantRepository:byIdGetModel:" . $id, Carbon::now()->addHours(24), function () use ($id) {
- return $this->model->where('id', $id)->where('status', AdminMerchant::STATUS_OK)->first();
- });
- }
- }
|