src/Engine/Traits/FromModelTraitPart/CollectionTrait.php
public function addPermissions($collection)
    {
        $newCollection = collect([]);

        $customActions = $this->crudeSetup->getCustomActions();

        $collection->each(function ($model) use ($newCollection, $customActions) {
            if ($this->permissionView($model)) {
                $model = $this->addPermissionsForModel($model, $customActions);
                $newCollection->push($model);
            }
        });

        return $newCollection;
    }
public function addPermissions($collection)
    {
        $newCollection = collect([]);

        $customActions = $this->crudeSetup->getCustomActions();

        $collection->each(function ($model) use ($newCollection, $customActions) {
            if ($this->permissionView($model)) {
                $model = $this->addPermissionsForModel($model, $customActions);
                $newCollection->push($model);
            }
        });

        return $newCollection;
    }
public function addPermissions ( $ collection ) { $ newCollection = collect ( [ ] ) ; $ customActions = $ this -> crudeSetup -> getCustomActions ( ) ; $ collection -> each ( function ( $ model ) use ( $ newCollection , $ customActions ) { if ( $ this -> permissionView ( $ model ) ) { $ model = $ this -> addPermissionsForModel ( $ model , $ customActions ) ; $ newCollection -> push ( $ model ) ; } } ) ; return $ newCollection ; }
Filter collection by permissions and add attributes canBeEdited and canBeRemoved
@param  Collection $collection
@return Collection
Filter collection by permissions and add attributes canBeEdited and canBeRemoved