-1

I want to send user permissions (sentry) to a blade page.user permission is a json object(as I know). it's controller code:

 $user = Sentry::findUserByID($id);
 $gr = Sentry::findGroupByName('admin');

    $permissions = $gr->permissions;
    $per = json_decode($permissions);
   return Redirect::route('admin_permit_user')->with('per', $per);

but it gave me this error:

json_decode() expects parameter 1 to be string, array give

ok and when I send $permissions before convert it by json_decode .I get the error:

   Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException

and in the url I see something like this:

   /admin/user/permission/%7Bid%7D     

is there anyway to convert json file to array? or what is my wrong? thanks for time.

cielo
  • 5
  • 1
  • 5
  • 1
    Can you show what `print_r($permissions)` gives? – Darren Aug 01 '14 at 06:30
  • @Darren :thanks for reply .yes it gives for example : Array ( [blog] => 1 ) – cielo Aug 01 '14 at 06:56
  • 1
    It isn't a json object, it's an array with one item in it (Called `blog` with a a value of `1`) – Darren Aug 01 '14 at 07:02
  • @Darren: I have thought like you but I searched and found that the sentry permissions returns json object. in the other hand if it is an array so I should be able to send it by :`return Redirect::route('admin_permit_user')->with('permissions', $permissions);`.but when I run it .I see in url something like that:/admin/user/permission/ ` %7Bid%7D `. and error in page: `Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException` – cielo Aug 01 '14 at 07:14
  • Update your question and put the errors you get there. – Darren Aug 01 '14 at 07:17

1 Answers1

0

Depending on how the route is defined, but first thing to repair:

return Redirect::route('admin_permit_user', $param);

it is clear expects some parameter and you are not giving it one, thys that stange strings.

peter.babic
  • 3,214
  • 3
  • 18
  • 31