Get checkbox values

How i get checkbox values in model???

//Volt
   {% for c in category %}
        {{ check_field(c.getIdCategory(), 'name': 'category[]', 'value': c.getIdCategory()) }} {{ c.getNameCategory() }}
    {% endfor %}
-----------------------------------------------------------------------------------
//Model
$categorys  = $this->request->getPost("category");

//error: Notice: Undefined variable: category
foreach ($categorys as $cat) {
            $category = new AppCategory();
            $category->setIdAppCategory($id_app);
            $category->setCategoryAppCategory($cat);
            $category->save();
} 

//error: Notice: Undefined variable: category
for ($i = 0; $i < count($category); $i++) {
            $category = new AppCategory();
            $category->setIdAppCategory($id_app);
            $category->setCategoryAppCategory($categorys[$i]);
            $category->save();
        }

$_POST['category'] won't be populated if no boxes were checked. Make sure that's not the case.

Next, do a print_r($_POST);exit() to see what POST actually looks like. It may not look like what you're expecting.