public function getCategoryTitleById($categoryId)
    {
        $category =  DB::table('categories')
            ->where('id', '=', $categoryId)
            ->first()
        ;

        return $category->title;
    }
public function getCategoryTitleById($categoryId)
    {
        $category =  DB::table('categories')
            ->where('id', '=', $categoryId)
            ->first()
        ;

        return $category->title;
    }
public function getCategoryTitleById ( $ categoryId ) { $ category = DB :: table ( 'categories' ) -> where ( 'id' , '=' , $ categoryId ) -> first ( ) ; return $ category -> title ; }
Find the category title by the category's id

I have this little function here because I do not want to inject the category's repository.

The purpose of having the category's title is to build a URL to all posts with that category.

@param  int     $categoryId   The category's ID
@return string
Find the category title by the category s id