保存时从数组值中删除双引号 - php

remove double quote from array value while saving - php

我有一个如下所示的数组,它来自以下形式:

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

我想像这样将它存储在数据库中:

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

但是,当我保存它时,它总是保存如下:

{
"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"
}

我想保存 value(true and false) 周围没有双引号的记录。我目前只是将值保存为 eloquent 值保存

$permissions = $request->get('permissions');
$role = Sentinel::findRoleBySlug($slug); //slug is role slug ex. admin, manager, user
$role->permissions = $permissions;
$role->save()

如何实现?

更新

我正在使用 Laravel 5.4 和 mysql 数据库,用于 ACL 的 Cartalyst Sentinel 包

这是解决上述问题的蛮力方法

foreach($myArray as $key=>$value){
    $myArray[$key] = $value==='true' ? true : false;
}