public function saveBrick($slug, $postValues)
    {
        $brickObject = BrickFactory::createBrickFromPostValues($postValues);

        $bricks = $this->repository->bricks;
        foreach ($bricks as $key => $brick) {
            if ($brick->slug == $slug) {
                $bricks[$key] = $brickObject;
            }
        }
        $this->repository->bricks = $bricks;
        $this->save();
    }
public function saveBrick($slug, $postValues)
    {
        $brickObject = BrickFactory::createBrickFromPostValues($postValues);

        $bricks = $this->repository->bricks;
        foreach ($bricks as $key => $brick) {
            if ($brick->slug == $slug) {
                $bricks[$key] = $brickObject;
            }
        }
        $this->repository->bricks = $bricks;
        $this->save();
    }
public function saveBrick ( $ slug , $ postValues ) { $ brickObject = BrickFactory :: createBrickFromPostValues ( $ postValues ) ; $ bricks = $ this -> repository -> bricks ; foreach ( $ bricks as $ key => $ brick ) { if ( $ brick -> slug == $ slug ) { $ bricks [ $ key ] = $ brickObject ; } } $ this -> repository -> bricks = $ bricks ; $ this -> save ( ) ; }
Save changes to a brick

@param $slug
@param $postValues

@throws \Exception
Save changes to a brick