You can use a session for that. Here's an example (using Laravels global session helper):
if (!session()->has('coupon_used')) {
\App\Coupon::where('coupon_id','=',$coupon[0]->coupon_id)->increment('no_paid');
session()->put('coupon_used', true);
}
This first checks if the session exists. If it doesn't, it runs the code and sets the session. The second time the page is loaded, the session will be set and the code won't run.
Alternatively
The above code only allows for one coupon per user session, regardless if they try different coupon ID's. If you want to add the same functionality, while allowing different coupons (being able to increment once/coupon id), then you can do this:
if (!session()->has('coupon_' . $coupon[0]->coupon_id)) {
\App\Coupon::where('coupon_id','=',$coupon[0]->coupon_id)->increment('no_paid');
session()->put('coupon_' . $coupon[0]->coupon_id, true);
}
This does the same thing, but sets a session for just that coupon ID (since it dynamically creates the session name to have the ID appended).