Skip to content
Snippets Groups Projects
Verified Commit ac812fbc authored by Damien's avatar Damien
Browse files

FEAT #7697 Add basket to a user when his group is added to the basket

parent 055708b1
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,8 @@ use Respect\Validation\Validator; ...@@ -25,6 +25,8 @@ use Respect\Validation\Validator;
use Slim\Http\Request; use Slim\Http\Request;
use Slim\Http\Response; use Slim\Http\Response;
use SrcCore\controllers\PreparedClauseController; use SrcCore\controllers\PreparedClauseController;
use User\models\UserBasketPreferenceModel;
use User\models\UserModel;
class BasketController class BasketController
{ {
...@@ -363,6 +365,18 @@ class BasketController ...@@ -363,6 +365,18 @@ class BasketController
} }
} }
} }
$users = GroupModel::getUsersByGroupId(['select' => ['id'], 'groupId' => $data['group_id']]);
$group = GroupModel::getByGroupId(['select' => ['id'], 'groupId' => $data['group_id']]);
foreach ($users as $user) {
UserBasketPreferenceModel::create([
'userSerialId' => $user['id'],
'groupSerialId' => $group['id'],
'basketId' => $aArgs['id'],
'display' => 'true',
]);
}
HistoryController::add([ HistoryController::add([
'tableName' => 'baskets', 'tableName' => 'baskets',
'recordId' => $aArgs['id'], 'recordId' => $aArgs['id'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment