From e5aa5f1a5b9fbe0ee5b2b9563957722cda3ab44c Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 15 Nov 2013 04:30:05 -0500 Subject: [PATCH] Added parentname method to get the name of the parent category for display --- app/models/Category.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/app/models/Category.php b/app/models/Category.php index 2e46bdd57b..9251acddb1 100644 --- a/app/models/Category.php +++ b/app/models/Category.php @@ -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'); } + + }