revert commit
This commit is contained in:
@@ -7,7 +7,7 @@ use Illuminate\Support\Facades\Broadcast;
|
||||
| Broadcast Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may register all of the Events broadcasting channels that your
|
||||
| Here you may register all of the event broadcasting channels that your
|
||||
| application supports. The given channel authorization callbacks are
|
||||
| used to check if an authenticated user can listen to the channel.
|
||||
|
|
||||
@@ -16,22 +16,3 @@ use Illuminate\Support\Facades\Broadcast;
|
||||
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
|
||||
return (int) $user->id === (int) $id;
|
||||
});
|
||||
|
||||
|
||||
|
||||
// کانال انتظار برای پیدا شدن حریف
|
||||
Broadcast::channel('matchmaking.{ticketId}', function ($user, $ticketId) {
|
||||
// در این مرحله، هر کاربری که لاگین باشد و تیکت خودش را داشته باشد اجازه دسترسی دارد
|
||||
return true;
|
||||
});
|
||||
|
||||
// کانال داخل بازی (برای ارسال پایان بازی یا تغییرات زنده)
|
||||
Broadcast::channel('pvp-match.{matchId}', function ($user, $matchId) {
|
||||
$match = \App\Models\PvpMatch::find($matchId);
|
||||
if (!$match) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// فقط اگر این کاربر یکی از دو بازیکنِ این مسابقه باشد، اجازه دسترسی به کانال را دارد
|
||||
return $match->players()->where('user_id', $user->id)->exists();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user