jeudi 26 septembre 2019

How to store the values from array checkbox in laravel controller with vuejs?

I want to store / save the values of my checkboxes from array. Please help i don't get the answers after searching and searching. I also use the spatie package laravel permission.

Role.vue

<ul>
<!-- Check All -->
<input type="checkbox" @click="select" v-model="isCheckAll"> Check All

   <li class="list-group-item bold" v-for="item in permissions" :key="item.id">
   <input type="checkbox" :value="item.id" v-model="selected" name="permission[]"> 
   </li>
</ul>

RoleController.php

if($request['permission']!= null){
            foreach ($request['permission'] as $value){
                $role->syncPermissions($request->all());
            }
        }

What i expect is to store all the values from my checkbox.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire