mysql - Allowing user input once per minute -
i have problem getting work.
the thing user allowed create comment 1 time per minute. simple that....
$checklastcomment = comment::where('user_id', '=', 1) ->where('created_at', '<', 'curdate() + interval 1 minute')->count();
you should utilize here rather:
$checklastcomment = comment::where('user_id', '=', $id) ->where('created_at', '>=', 'date_sub(now(), interval 1 minute)')->first(); if ($checklastcomment) { // user not allowed add together new comment }
mysql laravel laravel-4 eloquent query-builder
No comments:
Post a Comment