I want to create coupon module in my e-commerce mobile application, i want to know how to identify applied coupon of unique device, when i am not logged in i am confused for this can anyone help me.
i want to use cache system but to identify what do?
Let's suppose you have a $request->coupon_code and Eloquent relations (one to many) like User->coupons(), in this case, you can identify the user this way:
$user = User::whereHas('coupons', function ($query) {
$query->where('coupon_code', request()->coupon_code);
})->firstOrFail();