Added parentname method to get the name of the parent category for display
This commit is contained in:
+13
-12
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user