📜  laravel 搜索功能 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:41.654000             🧑  作者: Mango

代码示例3
$users = User::has('posts')->withCount('posts')->orderBy('posts_count')->take(50)->get();

$userIndex = $users->search(function($user) {
    return $user->id === Auth::id();
});