AdminMerchantRepository.php 606 B

1234567891011121314151617181920212223
  1. <?php
  2. namespace App\Repositories;
  3. use App\Maps\CacheMap;
  4. use App\Models\AdminMerchant;
  5. use Carbon\Carbon;
  6. use Illuminate\Support\Facades\Cache;
  7. class AdminMerchantRepository extends BaseRepository
  8. {
  9. public function __construct(AdminMerchant $model)
  10. {
  11. $this->model = $model;
  12. }
  13. public function byIdGetModel($id)
  14. {
  15. Cache::remember(CacheMap::DB . "AdminMerchantRepository:byIdGetModel:" . $id, Carbon::now()->addHours(24), function () use ($id) {
  16. return $this->model->where('id', $id)->where('status', AdminMerchant::STATUS_OK)->first();
  17. });
  18. }
  19. }