feat : menu list
This commit is contained in:
@@ -5,7 +5,9 @@ declare(strict_types=1);
|
||||
namespace App\Model;
|
||||
|
||||
use App\Constants\Admin\AuthCode;
|
||||
use Hyperf\Database\Model\Builder;
|
||||
use Hyperf\DbConnection\Model\Model;
|
||||
use Hyperf\Tappable\HigherOrderTapProxy;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
@@ -49,6 +51,30 @@ class AdminMenu extends Model
|
||||
*/
|
||||
public function getAllMenu(): array
|
||||
{
|
||||
return $this->where('status', AuthCode::MENU_STATUS_ENABLE)->orderBy('sort', 'desc')->get()->toArray();
|
||||
return $this
|
||||
->where('status', AuthCode::MENU_STATUS_ENABLE)
|
||||
->orderBy('sort', 'desc')
|
||||
->get()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $url
|
||||
* @return Builder|\Hyperf\Database\Model\Model|null
|
||||
*/
|
||||
public function getMenuByUrl(int $url): \Hyperf\Database\Model\Model|Builder|null
|
||||
{
|
||||
return $this
|
||||
->where('url', $url)
|
||||
->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return HigherOrderTapProxy|mixed|null
|
||||
*/
|
||||
public function getChildMenuType(int $id)
|
||||
{
|
||||
return $this->where('parent_id', $id)->value('type');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user