wip: live chat

1.1 User can request for message from explore page
1.2User cannot message broker if not following
1.3 prepare action which handles creating inbox between user and broker if not exists
This commit is contained in:
kusowl 2026-02-13 12:03:23 +05:30
parent a853b58f48
commit 59b74a6905
11 changed files with 366 additions and 94 deletions

View File

@ -1,22 +0,0 @@
<?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();
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Actions;
use App\Models\Inbox;
use App\Models\User;
use DB;
final readonly class CreateOrGetInboxAction
{
/**
*
* @throws \Throwable
*/
public function execute(User $recipient, User $sender): Inbox
{
$existingInbox = Inbox::whereHas('users', fn($q) => $q->where('id', $sender->id))
->whereHas('users', fn($q) => $q->where('id', $recipient->id))
->first();
if ($existingInbox) {
return $existingInbox;
}
return DB::transaction(function () use ($sender, $recipient) {
$inbox = Inbox::create();
$inbox->users()->attach([$sender->id, $recipient->id]);
return $inbox;
}, 2);
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class EnsureUserFollowedBroker
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
$sender = \Auth::user();
if ($sender->isBroker()) {
return $next($request);
}
$recipientUser = $request->route('recipient');
if ($recipientUser->isBroker()) {
$recipient = $recipientUser->type;
$isFollowing = $recipient->followers->contains($sender->id);
if ($isFollowing) {
return $next($request);
}
abort(403, 'You are not following this broker.');
}
abort('404', 'Broker not found.');
}
}

View File

@ -20,6 +20,13 @@
0 => 'BladeUI\\Icons\\BladeIconsServiceProvider',
),
),
'laradumps/laradumps' =>
array (
'providers' =>
array (
0 => 'LaraDumps\\LaraDumps\\LaraDumpsServiceProvider',
),
),
'laravel-notification-channels/webpush' =>
array (
'providers' =>

View File

@ -27,18 +27,19 @@
23 => 'Barryvdh\\LaravelIdeHelper\\IdeHelperServiceProvider',
24 => 'BladeUI\\Heroicons\\BladeHeroiconsServiceProvider',
25 => 'BladeUI\\Icons\\BladeIconsServiceProvider',
26 => 'NotificationChannels\\WebPush\\WebPushServiceProvider',
27 => 'Laravel\\Pail\\PailServiceProvider',
28 => 'Laravel\\Reverb\\ApplicationManagerServiceProvider',
29 => 'Laravel\\Reverb\\ReverbServiceProvider',
30 => 'Laravel\\Sail\\SailServiceProvider',
31 => 'Laravel\\Tinker\\TinkerServiceProvider',
32 => 'Carbon\\Laravel\\ServiceProvider',
33 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
34 => 'Termwind\\Laravel\\TermwindServiceProvider',
35 => 'Opcodes\\LogViewer\\LogViewerServiceProvider',
36 => 'Pest\\Laravel\\PestServiceProvider',
37 => 'App\\Providers\\AppServiceProvider',
26 => 'LaraDumps\\LaraDumps\\LaraDumpsServiceProvider',
27 => 'NotificationChannels\\WebPush\\WebPushServiceProvider',
28 => 'Laravel\\Pail\\PailServiceProvider',
29 => 'Laravel\\Reverb\\ApplicationManagerServiceProvider',
30 => 'Laravel\\Reverb\\ReverbServiceProvider',
31 => 'Laravel\\Sail\\SailServiceProvider',
32 => 'Laravel\\Tinker\\TinkerServiceProvider',
33 => 'Carbon\\Laravel\\ServiceProvider',
34 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
35 => 'Termwind\\Laravel\\TermwindServiceProvider',
36 => 'Opcodes\\LogViewer\\LogViewerServiceProvider',
37 => 'Pest\\Laravel\\PestServiceProvider',
38 => 'App\\Providers\\AppServiceProvider',
),
'eager' =>
array (
@ -54,15 +55,16 @@
9 => 'Illuminate\\View\\ViewServiceProvider',
10 => 'BladeUI\\Heroicons\\BladeHeroiconsServiceProvider',
11 => 'BladeUI\\Icons\\BladeIconsServiceProvider',
12 => 'NotificationChannels\\WebPush\\WebPushServiceProvider',
13 => 'Laravel\\Pail\\PailServiceProvider',
14 => 'Laravel\\Reverb\\ReverbServiceProvider',
15 => 'Carbon\\Laravel\\ServiceProvider',
16 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
17 => 'Termwind\\Laravel\\TermwindServiceProvider',
18 => 'Opcodes\\LogViewer\\LogViewerServiceProvider',
19 => 'Pest\\Laravel\\PestServiceProvider',
20 => 'App\\Providers\\AppServiceProvider',
12 => 'LaraDumps\\LaraDumps\\LaraDumpsServiceProvider',
13 => 'NotificationChannels\\WebPush\\WebPushServiceProvider',
14 => 'Laravel\\Pail\\PailServiceProvider',
15 => 'Laravel\\Reverb\\ReverbServiceProvider',
16 => 'Carbon\\Laravel\\ServiceProvider',
17 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
18 => 'Termwind\\Laravel\\TermwindServiceProvider',
19 => 'Opcodes\\LogViewer\\LogViewerServiceProvider',
20 => 'Pest\\Laravel\\PestServiceProvider',
21 => 'App\\Providers\\AppServiceProvider',
),
'deferred' =>
array (

View File

@ -20,6 +20,7 @@
"require-dev": {
"barryvdh/laravel-ide-helper": "^3.6",
"fakerphp/faker": "^1.23",
"laradumps/laradumps": "^5.0",
"laravel/pail": "^1.2.2",
"laravel/pint": "^1.24",
"laravel/sail": "^1.41",

294
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ad2793fd6165fc58fbde1567e1d3df58",
"content-hash": "e7b0ba578b3dd4a72b6d312716d071f2",
"packages": [
{
"name": "blade-ui-kit/blade-heroicons",
@ -158,16 +158,16 @@
},
{
"name": "brick/math",
"version": "0.14.6",
"version": "0.14.8",
"source": {
"type": "git",
"url": "https://github.com/brick/math.git",
"reference": "32498d5e1897e7642c0b961ace2df6d7dc9a3bc3"
"reference": "63422359a44b7f06cae63c3b429b59e8efcc0629"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/brick/math/zipball/32498d5e1897e7642c0b961ace2df6d7dc9a3bc3",
"reference": "32498d5e1897e7642c0b961ace2df6d7dc9a3bc3",
"url": "https://api.github.com/repos/brick/math/zipball/63422359a44b7f06cae63c3b429b59e8efcc0629",
"reference": "63422359a44b7f06cae63c3b429b59e8efcc0629",
"shasum": ""
},
"require": {
@ -206,7 +206,7 @@
],
"support": {
"issues": "https://github.com/brick/math/issues",
"source": "https://github.com/brick/math/tree/0.14.6"
"source": "https://github.com/brick/math/tree/0.14.8"
},
"funding": [
{
@ -214,7 +214,7 @@
"type": "github"
}
],
"time": "2026-02-05T07:59:58+00:00"
"time": "2026-02-10T14:33:43+00:00"
},
{
"name": "carbonphp/carbon-doctrine-types",
@ -1447,16 +1447,16 @@
},
{
"name": "laravel/framework",
"version": "v12.50.0",
"version": "v12.51.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "174ffed91d794a35a541a5eb7c3785a02a34aaba"
"reference": "ce4de3feb211e47c4f959d309ccf8a2733b1bc16"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/174ffed91d794a35a541a5eb7c3785a02a34aaba",
"reference": "174ffed91d794a35a541a5eb7c3785a02a34aaba",
"url": "https://api.github.com/repos/laravel/framework/zipball/ce4de3feb211e47c4f959d309ccf8a2733b1bc16",
"reference": "ce4de3feb211e47c4f959d309ccf8a2733b1bc16",
"shasum": ""
},
"require": {
@ -1665,20 +1665,20 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"time": "2026-02-04T18:34:13+00:00"
"time": "2026-02-10T18:20:19+00:00"
},
{
"name": "laravel/prompts",
"version": "v0.3.12",
"version": "v0.3.13",
"source": {
"type": "git",
"url": "https://github.com/laravel/prompts.git",
"reference": "4861ded9003b7f8a158176a0b7666f74ee761be8"
"reference": "ed8c466571b37e977532fb2fd3c272c784d7050d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/prompts/zipball/4861ded9003b7f8a158176a0b7666f74ee761be8",
"reference": "4861ded9003b7f8a158176a0b7666f74ee761be8",
"url": "https://api.github.com/repos/laravel/prompts/zipball/ed8c466571b37e977532fb2fd3c272c784d7050d",
"reference": "ed8c466571b37e977532fb2fd3c272c784d7050d",
"shasum": ""
},
"require": {
@ -1722,9 +1722,9 @@
"description": "Add beautiful and user-friendly forms to your command-line applications.",
"support": {
"issues": "https://github.com/laravel/prompts/issues",
"source": "https://github.com/laravel/prompts/tree/v0.3.12"
"source": "https://github.com/laravel/prompts/tree/v0.3.13"
},
"time": "2026-02-03T06:57:26+00:00"
"time": "2026-02-06T12:17:10+00:00"
},
{
"name": "laravel/reverb",
@ -2768,16 +2768,16 @@
},
{
"name": "nette/schema",
"version": "v1.3.3",
"version": "v1.3.4",
"source": {
"type": "git",
"url": "https://github.com/nette/schema.git",
"reference": "2befc2f42d7c715fd9d95efc31b1081e5d765004"
"reference": "086497a2f34b82fede9b5a41cc8e131d087cd8f7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/schema/zipball/2befc2f42d7c715fd9d95efc31b1081e5d765004",
"reference": "2befc2f42d7c715fd9d95efc31b1081e5d765004",
"url": "https://api.github.com/repos/nette/schema/zipball/086497a2f34b82fede9b5a41cc8e131d087cd8f7",
"reference": "086497a2f34b82fede9b5a41cc8e131d087cd8f7",
"shasum": ""
},
"require": {
@ -2785,8 +2785,8 @@
"php": "8.1 - 8.5"
},
"require-dev": {
"nette/tester": "^2.5.2",
"phpstan/phpstan-nette": "^2.0@stable",
"nette/tester": "^2.6",
"phpstan/phpstan": "^2.0@stable",
"tracy/tracy": "^2.8"
},
"type": "library",
@ -2827,22 +2827,22 @@
],
"support": {
"issues": "https://github.com/nette/schema/issues",
"source": "https://github.com/nette/schema/tree/v1.3.3"
"source": "https://github.com/nette/schema/tree/v1.3.4"
},
"time": "2025-10-30T22:57:59+00:00"
"time": "2026-02-08T02:54:00+00:00"
},
{
"name": "nette/utils",
"version": "v4.1.2",
"version": "v4.1.3",
"source": {
"type": "git",
"url": "https://github.com/nette/utils.git",
"reference": "f76b5dc3d6c6d3043c8d937df2698515b99cbaf5"
"reference": "bb3ea637e3d131d72acc033cfc2746ee893349fe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/utils/zipball/f76b5dc3d6c6d3043c8d937df2698515b99cbaf5",
"reference": "f76b5dc3d6c6d3043c8d937df2698515b99cbaf5",
"url": "https://api.github.com/repos/nette/utils/zipball/bb3ea637e3d131d72acc033cfc2746ee893349fe",
"reference": "bb3ea637e3d131d72acc033cfc2746ee893349fe",
"shasum": ""
},
"require": {
@ -2854,8 +2854,10 @@
},
"require-dev": {
"jetbrains/phpstorm-attributes": "^1.2",
"nette/phpstan-rules": "^1.0",
"nette/tester": "^2.5",
"phpstan/phpstan": "^2.0@stable",
"phpstan/extension-installer": "^1.4@stable",
"phpstan/phpstan": "^2.1@stable",
"tracy/tracy": "^2.9"
},
"suggest": {
@ -2916,9 +2918,9 @@
],
"support": {
"issues": "https://github.com/nette/utils/issues",
"source": "https://github.com/nette/utils/tree/v4.1.2"
"source": "https://github.com/nette/utils/tree/v4.1.3"
},
"time": "2026-02-03T17:21:09+00:00"
"time": "2026-02-13T03:05:33+00:00"
},
{
"name": "nikic/php-parser",
@ -7984,29 +7986,29 @@
},
{
"name": "doctrine/deprecations",
"version": "1.1.5",
"version": "1.1.6",
"source": {
"type": "git",
"url": "https://github.com/doctrine/deprecations.git",
"reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38"
"reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38",
"reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38",
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca",
"reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"conflict": {
"phpunit/phpunit": "<=7.5 || >=13"
"phpunit/phpunit": "<=7.5 || >=14"
},
"require-dev": {
"doctrine/coding-standard": "^9 || ^12 || ^13",
"phpstan/phpstan": "1.4.10 || 2.1.11",
"doctrine/coding-standard": "^9 || ^12 || ^14",
"phpstan/phpstan": "1.4.10 || 2.1.30",
"phpstan/phpstan-phpunit": "^1.0 || ^2",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12.4 || ^13.0",
"psr/log": "^1 || ^2 || ^3"
},
"suggest": {
@ -8026,9 +8028,9 @@
"homepage": "https://www.doctrine-project.org/",
"support": {
"issues": "https://github.com/doctrine/deprecations/issues",
"source": "https://github.com/doctrine/deprecations/tree/1.1.5"
"source": "https://github.com/doctrine/deprecations/tree/1.1.6"
},
"time": "2025-04-07T20:06:18+00:00"
"time": "2026-02-07T07:09:04+00:00"
},
{
"name": "fakerphp/faker",
@ -8336,6 +8338,148 @@
},
"time": "2025-03-19T14:43:43+00:00"
},
{
"name": "laradumps/laradumps",
"version": "v5.0.4",
"source": {
"type": "git",
"url": "https://github.com/laradumps/laradumps.git",
"reference": "bfce9338576fc052ed2271f8d6f1dc1da88b6e60"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laradumps/laradumps/zipball/bfce9338576fc052ed2271f8d6f1dc1da88b6e60",
"reference": "bfce9338576fc052ed2271f8d6f1dc1da88b6e60",
"shasum": ""
},
"require": {
"illuminate/mail": "^11.0|^12.0",
"illuminate/support": "^11.0|^12.0",
"laradumps/laradumps-core": "^4.0.3",
"php": "^8.2"
},
"require-dev": {
"larastan/larastan": "^3.8",
"laravel/framework": "^11.0|^12.0",
"laravel/pint": "^1.26.0",
"livewire/livewire": "^3.7.1|^4.0",
"mockery/mockery": "^1.6.12",
"orchestra/testbench-core": "^9.4|^10.0",
"pestphp/pest": "^3.7.0|^4.0.0",
"symfony/var-dumper": "^7.1.3|^8.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"LaraDumps\\LaraDumps\\LaraDumpsServiceProvider"
]
}
},
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"LaraDumps\\LaraDumps\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Luan Freitas",
"email": "luanfreitas10@protonmail.com",
"role": "Developer"
}
],
"description": "LaraDumps is a friendly app designed to boost your Laravel PHP coding and debugging experience.",
"homepage": "https://github.com/laradumps/laradumps",
"support": {
"issues": "https://github.com/laradumps/laradumps/issues",
"source": "https://github.com/laradumps/laradumps/tree/v5.0.4"
},
"funding": [
{
"url": "https://github.com/luanfreitasdev",
"type": "github"
}
],
"time": "2026-02-06T12:07:25+00:00"
},
{
"name": "laradumps/laradumps-core",
"version": "v4.0.3",
"source": {
"type": "git",
"url": "https://github.com/laradumps/laradumps-core.git",
"reference": "28d7997a26bae46c538844e20bcd51e023389e62"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laradumps/laradumps-core/zipball/28d7997a26bae46c538844e20bcd51e023389e62",
"reference": "28d7997a26bae46c538844e20bcd51e023389e62",
"shasum": ""
},
"require": {
"ext-curl": "*",
"php": "^8.2",
"ramsey/uuid": "^4.9.1",
"spatie/backtrace": "^1.5",
"symfony/console": "^6.4|^7.0|^8.0",
"symfony/finder": "^6.4|^7.0|^8.0",
"symfony/process": "^6.4|^7.0|^8.0",
"symfony/var-dumper": "^6.4|^7.0|^8.0",
"symfony/yaml": "^6.4|^7.0|^8.0"
},
"require-dev": {
"illuminate/support": "^12",
"laravel/pint": "^1.26.0",
"pestphp/pest": "^3.0|^4.0",
"phpstan/phpstan": "^1.10.50"
},
"suggest": {
"nunomaduro/termwind": "For a better terminal experience"
},
"bin": [
"bin/laradumps"
],
"type": "library",
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"LaraDumps\\LaraDumpsCore\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Luan Freitas",
"email": "luanfreitas10@protonmail.com",
"role": "Developer"
}
],
"description": "LaraDumps is a friendly app designed to boost your Laravel / PHP coding and debugging experience.",
"homepage": "https://github.com/laradumps/laradumps-core",
"support": {
"issues": "https://github.com/laradumps/laradumps-core/issues",
"source": "https://github.com/laradumps/laradumps-core/tree/v4.0.3"
},
"funding": [
{
"url": "https://github.com/luanfreitasdev",
"type": "github"
}
],
"time": "2026-02-06T12:03:23+00:00"
},
{
"name": "laravel/pail",
"version": "v1.2.5",
@ -11079,6 +11223,70 @@
],
"time": "2025-02-07T05:00:38+00:00"
},
{
"name": "spatie/backtrace",
"version": "1.8.1",
"source": {
"type": "git",
"url": "https://github.com/spatie/backtrace.git",
"reference": "8c0f16a59ae35ec8c62d85c3c17585158f430110"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/backtrace/zipball/8c0f16a59ae35ec8c62d85c3c17585158f430110",
"reference": "8c0f16a59ae35ec8c62d85c3c17585158f430110",
"shasum": ""
},
"require": {
"php": "^7.3 || ^8.0"
},
"require-dev": {
"ext-json": "*",
"laravel/serializable-closure": "^1.3 || ^2.0",
"phpunit/phpunit": "^9.3 || ^11.4.3",
"spatie/phpunit-snapshot-assertions": "^4.2 || ^5.1.6",
"symfony/var-dumper": "^5.1 || ^6.0 || ^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\Backtrace\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van de Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "A better backtrace",
"homepage": "https://github.com/spatie/backtrace",
"keywords": [
"Backtrace",
"spatie"
],
"support": {
"issues": "https://github.com/spatie/backtrace/issues",
"source": "https://github.com/spatie/backtrace/tree/1.8.1"
},
"funding": [
{
"url": "https://github.com/sponsors/spatie",
"type": "github"
},
{
"url": "https://spatie.be/open-source/support-us",
"type": "other"
}
],
"time": "2025-08-26T08:22:30+00:00"
},
{
"name": "staabm/side-effects-detector",
"version": "1.0.5",

View File

@ -1,13 +1,13 @@
@props(['broker' => '', 'is_followed' => false])
@props(['broker', 'is_followed' => false])
<div {{$attributes->merge(['class' => "p-4 text-sm bg-gray-100 border-gray-200 border rounded-xl"])}}>
<div class="flex space-x-2 items-center mb-2">
<p class="font-bold">Broker Contact</p>
<x-ui.button-sm data-is-loading="false" data-followed="{{$is_followed ? 'true' : 'false'}}"
onclick="follow(this, {{$broker->role_id ?? ''}})" class="followBtn group p-0! mt-0.5">
onclick="follow(this, {{$broker->role_id ?? 0}})" class="followBtn group p-0! mt-0.5">
<span class="group-data-[followed=true]:hidden text-blue-600">Follow</span>
<span class="group-data-[followed=false]:hidden text-accent-600">Unfollow</span>
</x-ui.button-sm>
<x-ui.button-sm>
<x-ui.button-sm :link="route('chat.show', ['recipient' => $broker->id ?? 0])">
<x-heroicon-o-chat-bubble-oval-left class="w-4 text-accent-600"/>
</x-ui.button-sm>
</div>

View File

@ -1,4 +1,4 @@
@props(['deal' => '', 'broker' => ''])
@props(['deal'])
<x-ui.image-card class="deal-identifier deal-card shadow-lg cursor-pointer" :image="asset('storage/'.$deal->image)"
data-deal-id="{{$deal->id}}">
<div class="bg-white pt-8 p-4 h-full space-y-2 flex flex-col justify-between">
@ -24,7 +24,7 @@
</a>
@endguest
@auth
<x-dashboard.user.broker-contact :broker="$broker" :is_followed="$deal->is_followed"/>
<x-dashboard.user.broker-contact :broker="$deal->broker" :is_followed="$deal->is_followed"/>
@endauth
<div class="flex justify-between items-center">

View File

@ -1,7 +1,7 @@
@props(['deals' => [], 'isInteractive'])
<div class="grid md:grid-cols-2 gap-6">
@forelse($deals as $deal)
<x-dashboard.user.listing-card :deal="$deal" :broker="$deal->broker"/>
<x-dashboard.user.listing-card :deal="$deal" />
@empty
<p class="col-span-2 text-sm text-center text-accent-600 mt-12">No Deals found !</p>
@endforelse

View File

@ -1,6 +1,12 @@
<?php
use App\Http\Controllers\ChatController;
use App\Http\Middleware\EnsureUserFollowedBroker;
Route::get('/chat', [ChatController::class, 'index'])->name('chat');
Route::get('/chat/{recipient}', [ChatController::class, 'show'])->name('chat.show');
Route::middleware('auth')->group(function () {
Route::get('/chat', [ChatController::class, 'index'])->name('chat');
Route::get('/chat/{recipient}', [ChatController::class, 'show'])
->middleware(EnsureUserFollowedBroker::class)
->name('chat.show');
});