<?php namespace App\Modules\Backend\Categories\Models;


class Category extends \Eloquent {



	/**
	 * The database table used by the model.
	 *
	 * @var string
	 */
	protected $table = 'categories';

	protected $fillable = array('title', 'category_parent', 'image');


	public static function findName($id)
	{
		$category = Category::find($id);
		if(!isset($category) || !$category->exists)
		{
			return trans('categories::label.without_parent');
		}
		else
		{
			return $category->title;
		}
	}
}