Added parentname method to get the name of the parent category for display

This commit is contained in:
snipe
2013-11-15 04:30:05 -05:00
parent 1bd87cca05
commit e5aa5f1a5b
+13 -12
View File
@@ -3,28 +3,29 @@
class Category extends Eloquent {
/**
* Deletes a blog post and all the associated comments.
* Deletes a category
*
* @return bool
*/
protected $table = 'categories';
public function delete()
{
// Delete the blog post
//return parent::delete();
// Delete the category
return parent::delete();
}
/**
* Returns a formatted post content entry, this ensures that
* line breaks are returned.
*
* @return string
*/
public function name()
* Get the parent category name
*/
public function parentname()
{
return nl2br($this->name);
return $this->belongsTo('Category','parent');
}
}