SELECT * FROM имя_таблицы WHERE условие GROUP BY user_id
$posts = Post::find()->limit(10)->groupBy('user_id')->all();
Route::get('login', 'Auth\LoginController@showLoginForm');
Route::post('login', 'Auth\LoginController@login');
Route::get('logout', 'Auth\LoginController@logout');
Auth::routes();
mysqli_error($conn)