mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-09-03 03:38:52 +00:00
Add getIdByName function to Category class
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
2017-10-06 DariusIII
|
||||
* Chg: Add getIdByName function to Category class
|
||||
* Chg: Update services.php with proper user model
|
||||
* Fix: Fix category display on pages
|
||||
* Chg: Update cs of some files, use Category model in Category class
|
||||
|
||||
@@ -313,6 +313,18 @@ class Category
|
||||
return $cat !== null ? $cat->parent->title.' -> '.$cat->title : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $title
|
||||
* @param $parent
|
||||
* @return bool|mixed
|
||||
*/
|
||||
public function getIdByName($title, $parent)
|
||||
{
|
||||
$cat = CategoryModel::query()->where('title', $title)->with('parent.' . $parent)->first(['id']);
|
||||
|
||||
return $cat !== null ? $cat->id : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a category.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user