dealhub/app/Actions/CreateOrGetInbox.php
kusowl a853b58f48 wip live chat
- add individual user chat view
- add routes
- wip: action to check and get inbox
2026-02-12 12:37:59 +05:30

23 lines
509 B
PHP

<?php
namespace App\Actions;
use App\Models\User;
use DB;
final readonly class CreateOrGetInbox
{
/**
* @return array<string, int>
*/
public function execute(User $recipient, User $sender): array
{
$chatExists = DB::table('inbox_user as sender')
->join('inbox_user as recipient', 'sender.inbox_id', '=', 'recipient.inbox_id')
->where('sender.user_id', $sender->id)
->where('recipient.user_id', $recipient->id)
->get();
}
}