create report fix
This commit is contained in:
parent
51b34ade1f
commit
2337bd75a1
@ -261,6 +261,10 @@ class ReportsController extends ApiController
|
||||
$params['created_at'] = date("Y-m-d");
|
||||
}
|
||||
|
||||
if (Reports::find()->where(['created_at' => $params['created_at'], 'user_id' => $params['user_id']])->exists()) {
|
||||
throw new BadRequestHttpException('Этот пользователь уже заполнил отчет в этот день');
|
||||
}
|
||||
|
||||
$reportsModel = new Reports();
|
||||
$reportsModel->attributes = $params;
|
||||
if (!$reportsModel->validate() || !$reportsModel->save()) {
|
||||
|
Loading…
Reference in New Issue
Block a user