Fix per vista menu

This commit is contained in:
Pek5892 2024-03-21 11:32:43 +01:00
parent ca88797519
commit 780c67102f
1 changed files with 12 additions and 5 deletions

View File

@ -177,9 +177,13 @@ class Module extends Model
public function children()
{
return $this->hasMany(self::class, 'parent')->withoutGlobalScope('enabled')
return $this->hasMany(self::class, 'parent')
->withoutGlobalScope('enabled')
->selectRaw('zz_modules.*, zz_modules_lang.title as title')
->join('zz_modules_lang', 'zz_modules.id', '=', 'zz_modules_lang.id_record')
->join('zz_modules_lang', function ($join) {
$join->on('zz_modules.id', '=', 'zz_modules_lang.id_record')
->where('zz_modules_lang.id_lang', '=', \Models\Locale::getDefault()->id);
})
->orderBy('order');
}
@ -201,13 +205,16 @@ class Module extends Model
public static function getHierarchy()
{
return self::with('allChildren')
->selectRaw('zz_modules.*, zz_modules_lang.title as title')
->join('zz_modules_lang', 'zz_modules.id', '=', 'zz_modules_lang.id_record')
->select('zz_modules.*', 'zz_modules_lang.title as title')
->join('zz_modules_lang', function ($join) {
$join->on('zz_modules.id', '=', 'zz_modules_lang.id_record')
->where('zz_modules_lang.id_lang', '=', \Models\Locale::getDefault()->id);
})
->withoutGlobalScope('enabled')
->whereNull('parent')
->orderBy('order')
->get();
}
}
protected static function boot()
{