Skip to content

Commands

Le Chat provides Laravel Commands to make your life easier.

Useful for debugging and testing, this command lets you send a message from a user, to a user, using the command line.

The required arguments are positional:

  • fromUserId: The ID of the user sending the message.
  • message: The content of the message to be sent.
  • toUserId: The ID of the user receiving the message.

le-chat:notify-users-of-recent-unread-messages

Section titled “le-chat:notify-users-of-recent-unread-messages”

This command is used to notify users of recent unread messages in their chatrooms. It will send notifications to all participants in the chatrooms where they have unread messages.

This is a useful command to run periodically, for example, via a cron job, to ensure that users are notified of any unread messages they may have missed.

Optional arguments:

  • --days: The number of days to look back for unread messages. Default is today (0 days).

You can schedule this command to run periodically in your routes/console.php file:

use Mmedia\LeChat\Commands\NotifyUsersOfRecentUnreadMessages;
Schedule::command(NotifyUsersOfRecentUnreadMessages::class, ['--days' => 1])
->dailyAt('09:00')
->description('Notify users of recent unread messages from the last day');