original_string: public function deleteBrickBySlug($slug)
      {
          $bricks = $this->repository->bricks;
          foreach ($bricks as $key => $brickObject) {
              if ($brickObject->slug == $slug) {
                  unset($bricks[$key]);
              }
          }
  
          $bricks = array_values($bricks);
          $this->repository->bricks = $bricks;
          $this->save();
      }
code: public function deleteBrickBySlug($slug)
      {
          $bricks = $this->repository->bricks;
          foreach ($bricks as $key => $brickObject) {
              if ($brickObject->slug == $slug) {
                  unset($bricks[$key]);
              }
          }
  
          $bricks = array_values($bricks);
          $this->repository->bricks = $bricks;
          $this->save();
      }
code_tokens: public function deleteBrickBySlug ( $ slug ) { $ bricks = $ this -> repository -> bricks ; foreach ( $ bricks as $ key => $ brickObject ) { if ( $ brickObject -> slug == $ slug ) { unset ( $ bricks [ $ key ] ) ; } } $ bricks = array_values ( $ bricks ) ; $ this -> repository -> bricks = $ bricks ; $ this -> save ( ) ; }
docstring: Delete a brick by its slug
  
  @param $slug
  
  @throws \Exception
docstring_tokens: Delete a brick by its slug