protected function import(array $input, Model $role)
    {
        if (isset($input['import']) && !is_null($from = $input['roles'])) {
            $permission = $this->foundation->make('antares.auth.permission');

            $permissions = $permission->where('role_id', $from)->get();

            $permissions->each(function(Model $model) use($permission, $role) {
                $attributes = $model->getAttributes();
                $insert     = array_except($attributes, ['id', 'role_id']) + ['role_id' => $role->id];
                $permission->newInstance($insert)->save();
            });
        }
        return true;
    }
protected function import(array $input, Model $role)
    {
        if (isset($input['import']) && !is_null($from = $input['roles'])) {
            $permission = $this->foundation->make('antares.auth.permission');

            $permissions = $permission->where('role_id', $from)->get();

            $permissions->each(function(Model $model) use($permission, $role) {
                $attributes = $model->getAttributes();
                $insert     = array_except($attributes, ['id', 'role_id']) + ['role_id' => $role->id];
                $permission->newInstance($insert)->save();
            });
        }
        return true;
    }
protected function import ( array $ input , Model $ role ) { if ( isset ( $ input [ 'import' ] ) && ! is_null ( $ from = $ input [ 'roles' ] ) ) { $ permission = $ this -> foundation -> make ( 'antares.auth.permission' ) ; $ permissions = $ permission -> where ( 'role_id' , $ from ) -> get ( ) ; $ permissions -> each ( function ( Model $ model ) use ( $ permission , $ role ) { $ attributes = $ model -> getAttributes ( ) ; $ insert = array_except ( $ attributes , [ 'id' , 'role_id' ] ) + [ 'role_id' => $ role -> id ] ; $ permission -> newInstance ( $ insert ) -> save ( ) ; } ) ; } return true ; }
import permissions when copy

@param array $input
@param Model $role
import permissions when copy