$userID =
(int) $identity->id;
$request =
$this->
Request();
$widgetId =
(int) $request->
getParam('id'
);
$column =
$request->
getParam('column'
);
$position =
$request->
getParam('position'
);
$data =
$request->
getParam('data',
[]);
$model =
new View();
$model->
setWidget($this->
get(ModelManager::
class)->
find(Widget::
class,
$widgetId));
$model->
setAuth($this->
get(ModelManager::
class)->
find(User::
class,
$userID));
$model->
setColumn($column);
$model->
setPosition($position);
$model->
setData($data);
$this->
get(ModelManager::
class)->
persist($model);
$this->
get(ModelManager::
class)->
flush();
$viewId =
$model->
getId();
$this->
View()->
assign(['success' => !
empty($viewId), 'viewId' =>
$viewId]);
} /**
* Removes active widgets by the passed views param
*
* @return void
*/