Saturday, April 1, 2017

How to create two different array which seperates role in one array and permission in another?

I have created a custom middleware Checkparam in this middleware i assign the guzzle http response to laravel attributes variable.

$data=json_decode((string) $result->getBody(), true);
   $request->attributes->add($data);

I access to controller

$list=$request->attributes;

   dd($list);

The output is :

    ParameterBag {#40 ▼
  #parameters: array:2 [▼
    "role" => array:1 [▼
      0 => array:6 [▶]
    ]
    "permission" => array:4 [▼
      0 => array:6 [▶]
      1 => array:6 [▶]
      2 => array:6 [▶]
      3 => array:6 [▶]
    ]
  ]
}

How can i create two separate array one containing role and another containing permission?



via ascc

Advertisement