public static function getCategoryWhereName($name) { $category = category::orderBy('id', 'desc')->get(); $convert = new convertString(); foreach ($category as $values) { if ($convert->convertString($values->name) == $name) { return $values->id; } } return 0; }
public function index() { $category = new category(); $data = $category->orderBy('id', 'desc')->get(); return View::make("admin.category.index", array('data' => $data)); }