original_string: private function storeOrUpdateCategory($request)
      {
          $cat = $this->category->whereName($request->name)->first();
  
          if (count($cat) > 0) {
              $category = $cat;
          } else {
              $category = new Category;
              $category->hash = $this->blogify->makeHash('categories', 'hash', true);
          }
  
          $category->name = $request->name;
          $category->save();
  
          return $category;
      }
code: private function storeOrUpdateCategory($request)
      {
          $cat = $this->category->whereName($request->name)->first();
  
          if (count($cat) > 0) {
              $category = $cat;
          } else {
              $category = new Category;
              $category->hash = $this->blogify->makeHash('categories', 'hash', true);
          }
  
          $category->name = $request->name;
          $category->save();
  
          return $category;
      }
code_tokens: private function storeOrUpdateCategory ( $ request ) { $ cat = $ this -> category -> whereName ( $ request -> name ) -> first ( ) ; if ( count ( $ cat ) > 0 ) { $ category = $ cat ; } else { $ category = new Category ; $ category -> hash = $ this -> blogify -> makeHash ( 'categories' , 'hash' , true ) ; } $ category -> name = $ request -> name ; $ category -> save ( ) ; return $ category ; }
docstring: Save the given category in the db
  
  @param CategoryRequest $request
  @return \jorenvanhocht\Blogify\Models\Category
docstring_tokens: Save the given category in the db