jeudi 19 janvier 2017

How to attach ids from array?

In vue.js i have array like this:

Array[4]
0:"5"
1:"7"
2:"9"
3:"72"

But when i do this in controller:

 $features[] = $request->features;

I get this:

array:1 [
  0 => "5,7,9,72"
]

What i want is to attach those ids like this:

  if(!empty($features)){
              $property->features()->attach($features);
        }

Any suggestion how can i do that? And am i doing something wrong?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2iNryGe
via IFTTT

Aucun commentaire:

Enregistrer un commentaire