refactor: 修改导航分类区分语言查询
This commit is contained in:
@@ -20,6 +20,7 @@ class Navigation
|
||||
'name'
|
||||
])
|
||||
->withSearch(['name'], ['name' => $name['name']??null])
|
||||
->language(request()->lang_id)
|
||||
->select();
|
||||
|
||||
return success('获取成功', $navs);
|
||||
@@ -41,6 +42,7 @@ class Navigation
|
||||
'created_at'
|
||||
])
|
||||
->withSearch(['name'], ['name' => $name['name']??null])
|
||||
->language(request()->lang_id)
|
||||
->paginate([
|
||||
'list_rows' => $name['size'],
|
||||
'page' => $name['page'],
|
||||
|
||||
@@ -11,6 +11,13 @@ use app\common\model\SysNavigationBaseModel;
|
||||
*/
|
||||
class SysNavigationModel extends SysNavigationBaseModel
|
||||
{
|
||||
// 按语言查询
|
||||
public function scopeLanguage($query, $value)
|
||||
{
|
||||
if (is_null($value)) return;
|
||||
$query->where('language_id', '=', $value);
|
||||
}
|
||||
|
||||
// 名称搜索
|
||||
public function searchNameAttr($query, $value)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user