i have a question about queries, how can i get the first element from a relationship hasMany in Laravel, i have a chats table with a relationship hasMany messages, i try with this, and take() and limit(), but without success
$chats = Chat::with(['messages' => function ($query) {
$query->first();
}])->get();