mardi 30 mai 2017

remove double quote from array value - php

I have an array like below which comes from form:

array:4 [▼
  "login-history.view" => "true"
  "login-history.create" => "true"
  "login-history.edit" => "true"
  "login-history.delete" => "true"
]

I want to store it in database like this:

{
"login-history.view":true, //without double qoute in value true and false.
"login-history.create":true,
"login-history.edit":true,
"login-history.delete":true
}

But, when I saved it, it always saves like below:

{
"login-history.view":"true", //I want to remove double quote around true and false for every value 
"login-history.create":"true",
"login-history.edit":"true",
"login-history.delete":"true"
}

I want to save the record without double qoute around value(true and false). I currently simply saving the values as in eloquent value saving

$role = Sentinel::findRoleBySlug($slug);
$role->permissions = $permissions;
$role->save()

How can I achieve it?



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

Aucun commentaire:

Enregistrer un commentaire