src/Stevemo/Cpanel/Controllers/UsersController.php
public function edit($id)
    {
        try
        {
            $user = $this->users->findById($id);
            $groups = $this->groups->findAll();

            $userPermissions = $user->getPermissions();
            $genericPermissions = $this->permissions->generic();
            $modulePermissions = $this->permissions->module();

            //get only the group id the user belong to
            $userGroupsId = array_pluck($user->getGroups()->toArray(), 'id');

            return View::make(Config::get('cpanel::views.users_edit'))
                ->with('user',$user)
                ->with('groups',$groups)
                ->with('userGroupsId',$userGroupsId)
                ->with('genericPermissions',$genericPermissions)
                ->with('modulePermissions',$modulePermissions)
                ->with('userPermissions',$userPermissions);
        }
        catch (UserNotFoundException $e)
        {
            return Redirect::route('cpanel.users.index')
                ->with('error',$e->getMessage());
        }
    }
public function edit($id)
    {
        try
        {
            $user = $this->users->findById($id);
            $groups = $this->groups->findAll();

            $userPermissions = $user->getPermissions();
            $genericPermissions = $this->permissions->generic();
            $modulePermissions = $this->permissions->module();

            //get only the group id the user belong to
            $userGroupsId = array_pluck($user->getGroups()->toArray(), 'id');

            return View::make(Config::get('cpanel::views.users_edit'))
                ->with('user',$user)
                ->with('groups',$groups)
                ->with('userGroupsId',$userGroupsId)
                ->with('genericPermissions',$genericPermissions)
                ->with('modulePermissions',$modulePermissions)
                ->with('userPermissions',$userPermissions);
        }
        catch (UserNotFoundException $e)
        {
            return Redirect::route('cpanel.users.index')
                ->with('error',$e->getMessage());
        }
    }
public function edit ( $ id ) { try { $ user = $ this -> users -> findById ( $ id ) ; $ groups = $ this -> groups -> findAll ( ) ; $ userPermissions = $ user -> getPermissions ( ) ; $ genericPermissions = $ this -> permissions -> generic ( ) ; $ modulePermissions = $ this -> permissions -> module ( ) ; //get only the group id the user belong to $ userGroupsId = array_pluck ( $ user -> getGroups ( ) -> toArray ( ) , 'id' ) ; return View :: make ( Config :: get ( 'cpanel::views.users_edit' ) ) -> with ( 'user' , $ user ) -> with ( 'groups' , $ groups ) -> with ( 'userGroupsId' , $ userGroupsId ) -> with ( 'genericPermissions' , $ genericPermissions ) -> with ( 'modulePermissions' , $ modulePermissions ) -> with ( 'userPermissions' , $ userPermissions ) ; } catch ( UserNotFoundException $ e ) { return Redirect :: route ( 'cpanel.users.index' ) -> with ( 'error' , $ e -> getMessage ( ) ) ; } }
Display the user edit form

@author Steve Montambeault
@link   http://stevemo.ca

@param int $id

@return \Illuminate\Http\RedirectResponse
Display the user edit form