app/Http/Controllers/ConversationController.php
// This function is used to mark a message as read
This function is used to mark a message as read
This function is used to mark a message as read
public function markAsReaded(Request $request)
    {
        $request->validate([
            'conversation_id'=>'required',
        ]);
    $conversation =  Conversation::findOrFail($request['conversation_id']);
    foreach ($conversation->messages as  $message)
    {
        $message->update(['read'=>true]);
    }
        return response()->json('success',200);
    }
public function markAsReaded ( Request $ request ) { $ request -> validate ( [ 'conversation_id' => 'required' , ] ) ; $ conversation = Conversation :: findOrFail ( $ request [ 'conversation_id' ] ) ; foreach ( $ conversation -> messages as $ message ) { $ message -> update ( [ 'read' => true ] ) ; } return response ( ) -> json ( 'success' , 200 ) ; }
This function is used to mark a message as read
This function is used to mark a message as read