Konversationsliste über HasConversations-Trait abrufbar
Ein neuer HasConversations-Trait für das User-Model stellt eine Eloquent-Beziehung zu Konversationen bereit, wobei updated_at mit neuen Nachrichten fortgeschrieben wird.
Pull request by @barryvdh
Building a conversation history sidebar previously meant writing raw SQL against the agent_conversations table. A new HasConversations trait for your User model exposes a proper Eloquent relationship, with updated_at advancing as messages arrive so ordering by recency just works.
class User extends Authenticatable
{
use HasConversations;
}
$conversations = $request->user()
->conversations()
->latest('updated_at')
->paginate(20);