如上,怎么将$title 像$query一样,在函数内部使用?
$result = UserMenus::with(['menu'=>function($query){
$query->where('title',$title);
}])->where('user_id',$userId)->first();
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
话说PHP 有全局函数,你加global 不行吗?