Compare commits

...
2 Commits
38 changed files with 2437 additions and 215 deletions

No files matched your search

+18 -13
View File
@@ -18,7 +18,8 @@ DB_DATABASE=postshop
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
# Use `reverb` for live chat (`php artisan reverb:start`). `log` is fine without websockets.
BROADCAST_DRIVER=reverb
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
@@ -46,16 +47,20 @@ AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1
# Storefront widget + Nova inbox 1:1 target (users.id)
CHAT_SUPPORT_USER_ID=
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
# Laravel Reverb (`php artisan reverb:start`)
REVERB_APP_ID=
REVERB_APP_KEY=
REVERB_APP_SECRET=
REVERB_HOST=127.0.0.1
REVERB_PORT=8080
REVERB_SCHEME=http
REVERB_SERVER_HOST=0.0.0.0
REVERB_SERVER_PORT=8080
VITE_REVERB_APP_KEY="${REVERB_APP_KEY}"
VITE_REVERB_HOST="${REVERB_HOST}"
VITE_REVERB_PORT="${REVERB_PORT}"
VITE_REVERB_SCHEME="${REVERB_SCHEME}"
+32 -5
View File
@@ -2,6 +2,8 @@
namespace App\Events\Conversation;
use App\Http\Controllers\Api\V1\Chat\Resources\MessageResource;
use App\Models\Chat\Message;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
@@ -13,14 +15,12 @@ class MessageSent implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $message;
/**
* Create a new event instance.
*/
public function __construct($message)
public function __construct(private Message $message)
{
$this->message = $message->load('user');
$this->message->loadMissing('user');
}
/**
@@ -30,8 +30,35 @@ public function __construct($message)
*/
public function broadcastOn(): array
{
return [
$channels = [
new PrivateChannel('chat.'.$this->message->conversation_id),
];
$supportId = (int) config('chat.support_user_id');
if ($supportId > 0) {
$isSupportConversation = $this->message->conversation()
->whereHas('users', fn ($query) => $query->where('users.id', $supportId))
->exists();
if ($isSupportConversation) {
$channels[] = new PrivateChannel('chat.support');
}
}
return $channels;
}
public function broadcastAs(): string
{
return 'message.sent';
}
/**
* @return array<string, mixed>
*/
public function broadcastWith(): array
{
return (new MessageResource($this->message->loadMissing('user')))->resolve();
}
}
@@ -0,0 +1,163 @@
<?php
namespace App\Http\Controllers\Api\V1\Chat;
use App\Events\Conversation\MessageSent;
use App\Http\Controllers\Api\V1\Chat\Requests\ChatContactsRequest;
use App\Http\Controllers\Api\V1\Chat\Requests\ChatMessagesRequest;
use App\Http\Controllers\Api\V1\Chat\Requests\ChatSendMessageRequest;
use App\Http\Controllers\Api\V1\Chat\Requests\ChatStartRequest;
use App\Http\Controllers\Api\V1\Chat\Resources\ChatUserResource;
use App\Http\Controllers\Api\V1\Chat\Resources\ConversationResource;
use App\Http\Controllers\Api\V1\Chat\Resources\MessageResource;
use App\Http\Controllers\Controller;
use App\Models\Chat\Conversation;
use App\Models\Chat\Message;
use App\Models\User;
use App\Support\ChatSupport;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ChatController extends Controller
{
/**
* (*) Chat conversations (inbox)
*/
public function conversations(): JsonResponse
{
$conversations = Conversation::inboxFor(auth()->user());
return response()->rest(ConversationResource::collection($conversations));
}
/**
* (*) Existing support conversation (does not create)
*/
public function showSupport(Request $request): JsonResponse
{
abort_if(ChatSupport::isSupportUser($request->user()), 403);
$conversation = Conversation::findOneToOne(
$request->user()->id,
ChatSupport::user()->id
);
if (! $conversation) {
return response()->rest(null);
}
$conversation->loadForViewer($request->user());
return response()->rest(new ConversationResource($conversation));
}
/**
* (*) Find or create the 1:1 support conversation
*/
public function support(Request $request): JsonResponse
{
abort_if(ChatSupport::isSupportUser($request->user()), 403);
$conversation = Conversation::findOrCreateOneToOne(
$request->user()->id,
ChatSupport::user()->id
);
$conversation->loadForViewer($request->user());
return response()->rest(new ConversationResource($conversation));
}
/**
* (*) Searchable chat contacts
*/
public function contacts(ChatContactsRequest $request): JsonResponse
{
abort_unless(ChatSupport::isOperator($request->user()), 403);
$paginator = User::query()
->select(['id', 'first_name', 'last_name'])
->where('id', '!=', $request->user()->id)
->when($request->q, function ($query, $search) {
$query->where(function ($query) use ($search) {
$query->where('first_name', 'like', '%'.$search.'%')
->orWhere('last_name', 'like', '%'.$search.'%')
->orWhere('phone_number', 'like', '%'.$search.'%');
});
})
->orderBy('first_name')
->simplePaginate($request->perPage);
$paginator->through(fn (User $user) => (new ChatUserResource($user))->resolve());
return response()->rest_paginate($paginator);
}
/**
* (*) Find or create a 1:1 conversation
*/
public function start(ChatStartRequest $request): JsonResponse
{
abort_unless(ChatSupport::isOperator($request->user()), 403);
$conversation = Conversation::findOrCreateOneToOne(
$request->user()->id,
$request->integer('user_id')
);
$conversation->loadForViewer($request->user());
return response()->rest(new ConversationResource($conversation));
}
/**
* (*) Conversation messages
*/
public function messages(ChatMessagesRequest $request, Conversation $conversation): JsonResponse
{
abort_unless($conversation->hasParticipant($request->user()), 403);
$paginator = $conversation->messages()
->with('user')
->latest()
->simplePaginate($request->perPage);
$paginator->through(fn (Message $message) => (new MessageResource($message))->resolve());
return response()->rest_paginate($paginator);
}
/**
* (*) Send a message
*/
public function send(ChatSendMessageRequest $request, Conversation $conversation): JsonResponse
{
abort_unless($conversation->hasParticipant($request->user()), 403);
$message = $conversation->messages()->create([
'user_id' => $request->user()->id,
'body' => $request->validated('body'),
]);
$message->load('user');
broadcast(new MessageSent($message))->toOthers();
return response()->rest(new MessageResource($message), 201);
}
/**
* (*) Mark the other user's messages as seen
*/
public function read(Conversation $conversation): JsonResponse
{
abort_unless($conversation->hasParticipant(auth()->user()), 403);
$conversation->messages()
->where('user_id', '!=', auth()->id())
->whereNull('seen_at')
->update(['seen_at' => now()]);
return response()->rest();
}
}
@@ -0,0 +1,27 @@
<?php
namespace App\Http\Controllers\Api\V1\Chat\Requests;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class ChatContactsRequest extends FormRequest
{
/**
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'q' => ['nullable', 'string', 'max:100'],
'perPage' => ['nullable', 'integer', 'min:1', 'max:50'],
];
}
protected function passedValidation(): void
{
$this->merge([
'perPage' => $this->perPage ?: 20,
]);
}
}
@@ -0,0 +1,26 @@
<?php
namespace App\Http\Controllers\Api\V1\Chat\Requests;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class ChatMessagesRequest extends FormRequest
{
/**
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'perPage' => ['nullable', 'integer', 'min:1', 'max:100'],
];
}
protected function passedValidation(): void
{
$this->merge([
'perPage' => $this->perPage ?: 50,
]);
}
}
@@ -0,0 +1,19 @@
<?php
namespace App\Http\Controllers\Api\V1\Chat\Requests;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class ChatSendMessageRequest extends FormRequest
{
/**
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'body' => ['required', 'string', 'max:5000'],
];
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers\Api\V1\Chat\Requests;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ChatStartRequest extends FormRequest
{
/**
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'user_id' => ['required', 'integer', 'exists:users,id', Rule::notIn([$this->user()->id])],
];
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers\Api\V1\Chat\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class ChatUserResource extends JsonResource
{
/**
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'name' => $this->fullname,
];
}
}
@@ -0,0 +1,31 @@
<?php
namespace App\Http\Controllers\Api\V1\Chat\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class ConversationResource extends JsonResource
{
/**
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
$otherUser = $this->relationLoaded('users')
? $this->users->firstWhere('id', '!=', $request->user()?->id)
: null;
return [
'id' => $this->id,
'user' => $this->when($otherUser, fn () => new ChatUserResource($otherUser)),
'last_message' => $this->when(
$this->relationLoaded('latestMessage') && $this->latestMessage,
fn () => new MessageResource($this->latestMessage)
),
'unread_count' => (int) ($this->unread_count ?? 0),
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];
}
}
@@ -0,0 +1,25 @@
<?php
namespace App\Http\Controllers\Api\V1\Chat\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class MessageResource extends JsonResource
{
/**
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'conversation_id' => $this->conversation_id,
'body' => $this->body,
'seen_at' => $this->seen_at,
'user' => new ChatUserResource($this->whenLoaded('user')),
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];
}
}
-65
View File
@@ -1,65 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Events\Conversation\MessageSent;
use App\Models\Chat\Conversation;
use App\Models\Chat\Message;
use App\Models\User;
use Illuminate\Http\Request;
class ChatController extends Controller
{
public function contacts()
{
return User::select(['id', 'first_name', 'last_name'])
->get()
->map(function ($user) {
return [
'id' => $user->id,
'name' => $user->first_name.' '.$user->last_name,
];
});
}
public function start(Request $request)
{
$user1 = auth()->id();
$user2 = $request->user_id;
$conversation = Conversation::whereHas('users', fn ($q) => $q->where('user_id', $user1))
->whereHas('users', fn ($q) => $q->where('user_id', $user2))
->first();
if (! $conversation) {
$conversation = Conversation::create();
$conversation->users()->attach([$user1, $user2]);
}
return $conversation;
}
public function messages($id)
{
return Message::with('user')
->where('conversation_id', $id)
->latest()
->take(50)
->get()
->reverse()
->values();
}
public function send(Request $request)
{
$message = Message::create([
'conversation_id' => $request->conversation_id,
'user_id' => auth()->id(),
'body' => $request->body,
]);
broadcast(new MessageSent($message))->toOthers();
return $message->load('user');
}
}
@@ -0,0 +1,92 @@
<?php
namespace App\Http\Controllers\Nova;
use App\Events\Conversation\MessageSent;
use App\Http\Controllers\Api\V1\Chat\Requests\ChatMessagesRequest;
use App\Http\Controllers\Api\V1\Chat\Requests\ChatSendMessageRequest;
use App\Http\Controllers\Api\V1\Chat\Resources\MessageResource;
use App\Http\Controllers\Controller;
use App\Models\Chat\Conversation;
use App\Models\Chat\Message;
use App\Models\User;
use App\Support\ChatSupport;
use Illuminate\Http\JsonResponse;
use Illuminate\View\View;
class SupportChatController extends Controller
{
public function index(): View
{
return view('nova.chat', [
'pusher' => [
'key' => config('broadcasting.connections.reverb.key'),
'host' => config('broadcasting.connections.reverb.options.host'),
'port' => (int) config('broadcasting.connections.reverb.options.port', 8080),
'scheme' => config('broadcasting.connections.reverb.options.scheme', 'http'),
],
]);
}
public function conversations(): JsonResponse
{
$support = ChatSupport::user();
$conversations = Conversation::inboxFor($support)
->map(fn (Conversation $conversation) => ChatSupport::conversationPayload($conversation, $support, true))
->values();
return response()->rest($conversations);
}
public function messages(ChatMessagesRequest $request, Conversation $conversation): JsonResponse
{
$this->assertSupportConversation($conversation);
$paginator = $conversation->messages()
->with('user')
->latest()
->simplePaginate($request->perPage);
$paginator->through(fn (Message $message) => (new MessageResource($message))->resolve());
return response()->rest_paginate($paginator);
}
public function send(ChatSendMessageRequest $request, Conversation $conversation): JsonResponse
{
$support = $this->assertSupportConversation($conversation);
$message = $conversation->messages()->create([
'user_id' => $support->id,
'body' => $request->validated('body'),
]);
$message->load('user');
broadcast(new MessageSent($message))->toOthers();
return response()->rest(new MessageResource($message), 201);
}
public function read(Conversation $conversation): JsonResponse
{
$support = $this->assertSupportConversation($conversation);
$conversation->messages()
->where('user_id', '!=', $support->id)
->whereNull('seen_at')
->update(['seen_at' => now()]);
return response()->rest();
}
private function assertSupportConversation(Conversation $conversation): User
{
$support = ChatSupport::user();
abort_unless($conversation->hasParticipant($support), 403);
return $support;
}
}
+2
View File
@@ -5,6 +5,7 @@
use App\Http\Middleware\Authenticate;
use App\Http\Middleware\CheckApiToken;
use App\Http\Middleware\CheckIfUserIsBanned;
use App\Http\Middleware\EnsureChatOperator;
use App\Http\Middleware\EncryptCookies;
use App\Http\Middleware\EnsureUserHasRole;
use App\Http\Middleware\PreventRequestsDuringMaintenance;
@@ -93,5 +94,6 @@ class Kernel extends HttpKernel
'set_lang' => SetLanguage::class,
'banned' => CheckIfUserIsBanned::class,
'role' => EnsureUserHasRole::class,
'chat.operator' => EnsureChatOperator::class,
];
}
@@ -0,0 +1,18 @@
<?php
namespace App\Http\Middleware;
use App\Support\ChatSupport;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class EnsureChatOperator
{
public function handle(Request $request, Closure $next): Response
{
abort_unless(ChatSupport::isOperator($request->user()), 403);
return $next($request);
}
}
+72 -2
View File
@@ -3,20 +3,90 @@
namespace App\Models\Chat;
use App\Models\User;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
class Conversation extends Model
{
use HasFactory;
public function users()
/**
* Find a 1:1 conversation between two users.
*/
public static function findOneToOne(int $userId, int $otherUserId): ?self
{
return static::query()
->whereHas('users', fn ($query) => $query->where('users.id', $userId))
->whereHas('users', fn ($query) => $query->where('users.id', $otherUserId))
->has('users', '=', 2)
->first();
}
/**
* Find or create a 1:1 conversation between two users.
*/
public static function findOrCreateOneToOne(int $userId, int $otherUserId): self
{
$conversation = static::findOneToOne($userId, $otherUserId);
if ($conversation) {
return $conversation;
}
$conversation = static::create();
$conversation->users()->attach([$userId, $otherUserId]);
return $conversation;
}
/**
* Inbox for a participant, newest activity first.
*/
public static function inboxFor(User $viewer): Collection
{
return $viewer->conversations()
->with(['users', 'latestMessage.user'])
->withCount([
'messages as unread_count' => fn ($query) => $query
->where('user_id', '!=', $viewer->id)
->whereNull('seen_at'),
])
->withMax('messages', 'created_at')
->orderByDesc('messages_max_created_at')
->get();
}
public function loadForViewer(User $viewer): self
{
return $this->load(['users', 'latestMessage.user'])
->loadCount([
'messages as unread_count' => fn ($query) => $query
->where('user_id', '!=', $viewer->id)
->whereNull('seen_at'),
]);
}
public function users(): BelongsToMany
{
return $this->belongsToMany(User::class);
}
public function messages()
public function messages(): HasMany
{
return $this->hasMany(Message::class);
}
public function latestMessage(): HasOne
{
return $this->hasOne(Message::class)->latestOfMany();
}
public function hasParticipant(User $user): bool
{
return $this->users()->where('users.id', $user->id)->exists();
}
}
+24 -1
View File
@@ -5,12 +5,35 @@
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Message extends Model
{
use HasFactory;
public function user()
/**
* @var array<int, string>
*/
protected $fillable = [
'conversation_id',
'user_id',
'body',
'seen_at',
];
/**
* @var array<string, string>
*/
protected $casts = [
'seen_at' => 'datetime',
];
public function conversation(): BelongsTo
{
return $this->belongsTo(Conversation::class);
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
+10
View File
@@ -2,6 +2,7 @@
namespace App\Models;
use App\Models\Chat\Conversation;
use App\Models\Concerns\HasEcommerceChannels;
use App\Models\Concerns\HasSchemalessAttributes;
use App\Models\Concerns\InteractsWithNova;
@@ -15,6 +16,7 @@
use App\Repositories\System\Cache\CacheRepository;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Foundation\Auth\User as Authenticatable;
@@ -112,6 +114,14 @@ public function addresses(): HasMany
return $this->hasMany(UserAddress::class);
}
/**
* Chat conversations
*/
public function conversations(): BelongsToMany
{
return $this->belongsToMany(Conversation::class);
}
/**
* User's carts
*/
+9 -1
View File
@@ -2,8 +2,11 @@
namespace App\Providers;
use App\Http\Middleware\EnsureChatOperator;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
use Laravel\Nova\Http\Middleware\Authenticate as NovaAuthenticate;
use Laravel\Nova\Http\Middleware\Authorize as NovaAuthorize;
class BroadcastServiceProvider extends ServiceProvider
{
@@ -12,7 +15,12 @@ class BroadcastServiceProvider extends ServiceProvider
*/
public function boot(): void
{
Broadcast::routes();
Broadcast::routes(['middleware' => ['auth:sanctum']]);
Broadcast::routes([
'prefix' => 'panel',
'middleware' => ['web', NovaAuthenticate::class, NovaAuthorize::class, EnsureChatOperator::class],
]);
require base_path('routes/channels.php');
}
+6
View File
@@ -36,6 +36,7 @@
use App\Nova\Seller\Seller;
use App\Nova\User;
use App\Repositories\Nova\NovaRepo;
use App\Support\ChatSupport;
use Eolica\NovaLocaleSwitcher\LocaleSwitcher;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Gate;
@@ -200,6 +201,11 @@ public function setupNavigation(): void
MenuItem::resource(Coupon::class),
])->icon('presentation-chart-bar')->collapsedByDefault(),
MenuSection::make(__('Chat'), [
MenuItem::externalLink(__('Inbox'), url('/panel/chat')),
])->icon('chat-alt-2')
->canSee(fn (Request $request) => ChatSupport::isOperator($request->user())),
MenuSection::make('Hatlar', [
MenuItem::resource(ContactUS::class),
])->icon('inbox-in')->collapsedByDefault(),
+92
View File
@@ -0,0 +1,92 @@
<?php
namespace App\Support;
use App\Http\Controllers\Api\V1\Chat\Resources\ChatUserResource;
use App\Http\Controllers\Api\V1\Chat\Resources\MessageResource;
use App\Models\Chat\Conversation;
use App\Models\User;
use Illuminate\Support\Facades\DB;
class ChatSupport
{
public static function userId(): ?int
{
$id = (int) config('chat.support_user_id');
return $id > 0 ? $id : null;
}
public static function user(): User
{
$id = static::userId();
abort_unless($id, 422, 'Chat support user is not configured.');
$user = User::query()->find($id);
abort_unless($user, 422, 'Chat support user was not found.');
return $user;
}
public static function isSupportUser(?User $user): bool
{
$id = static::userId();
return $user !== null && $id !== null && (int) $user->id === $id;
}
/**
* Nova staff who may operate the support inbox (vendors excluded).
*/
public static function isOperator(?User $user): bool
{
if ($user === null) {
return false;
}
return $user->isMe() || $user->isAdmin() || $user->isDirektor() || $user->isManager();
}
public static function conversationIncludesSupport(int $conversationId): bool
{
$id = static::userId();
if ($id === null) {
return false;
}
return DB::table('conversation_user')
->where('conversation_id', $conversationId)
->where('user_id', $id)
->exists();
}
/**
* @return array<string, mixed>
*/
public static function conversationPayload(Conversation $conversation, User $viewer, bool $includePhone = false): array
{
$conversation->loadMissing(['users', 'latestMessage.user']);
$otherUser = $conversation->users->firstWhere('id', '!=', $viewer->id);
$user = $otherUser ? (new ChatUserResource($otherUser))->resolve() : null;
if ($includePhone && $otherUser && is_array($user)) {
$user['phone_number'] = $otherUser->phone_number;
}
return [
'id' => $conversation->id,
'user' => $user,
'last_message' => $conversation->latestMessage
? (new MessageResource($conversation->latestMessage))->resolve()
: null,
'unread_count' => (int) ($conversation->unread_count ?? 0),
'created_at' => $conversation->created_at,
'updated_at' => $conversation->updated_at,
];
}
}
+1
View File
@@ -18,6 +18,7 @@
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.10",
"laravel/nova": "*",
"laravel/reverb": "^1.11",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8",
"maatwebsite/excel": "^3.1",
Generated
+846 -1
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": "3758ca8376a4ceb686f0265581777fd8",
"content-hash": "6c8f85c880987851c5a8908689974f71",
"packages": [
{
"name": "blendbyte/nova-attach-many",
@@ -239,6 +239,136 @@
],
"time": "2023-12-11T17:09:12+00:00"
},
{
"name": "clue/redis-protocol",
"version": "v0.3.2",
"source": {
"type": "git",
"url": "https://github.com/clue/redis-protocol.git",
"reference": "6f565332f5531b7722d1e9c445314b91862f6d6c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/clue/redis-protocol/zipball/6f565332f5531b7722d1e9c445314b91862f6d6c",
"reference": "6f565332f5531b7722d1e9c445314b91862f6d6c",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36"
},
"type": "library",
"autoload": {
"psr-4": {
"Clue\\Redis\\Protocol\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@lueck.tv"
}
],
"description": "A streaming Redis protocol (RESP) parser and serializer written in pure PHP.",
"homepage": "https://github.com/clue/redis-protocol",
"keywords": [
"parser",
"protocol",
"redis",
"resp",
"serializer",
"streaming"
],
"support": {
"issues": "https://github.com/clue/redis-protocol/issues",
"source": "https://github.com/clue/redis-protocol/tree/v0.3.2"
},
"funding": [
{
"url": "https://clue.engineering/support",
"type": "custom"
},
{
"url": "https://github.com/clue",
"type": "github"
}
],
"time": "2024-08-07T11:06:28+00:00"
},
{
"name": "clue/redis-react",
"version": "v2.8.0",
"source": {
"type": "git",
"url": "https://github.com/clue/reactphp-redis.git",
"reference": "84569198dfd5564977d2ae6a32de4beb5a24bdca"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/clue/reactphp-redis/zipball/84569198dfd5564977d2ae6a32de4beb5a24bdca",
"reference": "84569198dfd5564977d2ae6a32de4beb5a24bdca",
"shasum": ""
},
"require": {
"clue/redis-protocol": "^0.3.2",
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
"php": ">=5.3",
"react/event-loop": "^1.2",
"react/promise": "^3.2 || ^2.0 || ^1.1",
"react/promise-timer": "^1.11",
"react/socket": "^1.16"
},
"require-dev": {
"clue/block-react": "^1.5",
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36"
},
"type": "library",
"autoload": {
"psr-4": {
"Clue\\React\\Redis\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@clue.engineering"
}
],
"description": "Async Redis client implementation, built on top of ReactPHP.",
"homepage": "https://github.com/clue/reactphp-redis",
"keywords": [
"async",
"client",
"database",
"reactphp",
"redis"
],
"support": {
"issues": "https://github.com/clue/reactphp-redis/issues",
"source": "https://github.com/clue/reactphp-redis/tree/v2.8.0"
},
"funding": [
{
"url": "https://clue.engineering/support",
"type": "custom"
},
{
"url": "https://github.com/clue",
"type": "github"
}
],
"time": "2025-01-03T16:18:33+00:00"
},
{
"name": "composer/pcre",
"version": "3.3.2",
@@ -1330,6 +1460,53 @@
},
"time": "2024-03-18T11:24:55+00:00"
},
{
"name": "evenement/evenement",
"version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/igorw/evenement.git",
"reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/igorw/evenement/zipball/0a16b0d71ab13284339abb99d9d2bd813640efbc",
"reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc",
"shasum": ""
},
"require": {
"php": ">=7.0"
},
"require-dev": {
"phpunit/phpunit": "^9 || ^6"
},
"type": "library",
"autoload": {
"psr-4": {
"Evenement\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Igor Wiedler",
"email": "igor@wiedler.ch"
}
],
"description": "Événement is a very simple event dispatching library for PHP",
"keywords": [
"event-dispatcher",
"event-emitter"
],
"support": {
"issues": "https://github.com/igorw/evenement/issues",
"source": "https://github.com/igorw/evenement/tree/v3.0.2"
},
"time": "2023-08-08T05:53:35+00:00"
},
{
"name": "ezyang/htmlpurifier",
"version": "v4.19.0",
@@ -2526,6 +2703,85 @@
},
"time": "2024-08-12T22:06:33+00:00"
},
{
"name": "laravel/reverb",
"version": "v1.11.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/reverb.git",
"reference": "52ce5fd88cd1d7eacfdcf6b91cea4704cc546f27"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/reverb/zipball/52ce5fd88cd1d7eacfdcf6b91cea4704cc546f27",
"reference": "52ce5fd88cd1d7eacfdcf6b91cea4704cc546f27",
"shasum": ""
},
"require": {
"clue/redis-react": "^2.6",
"guzzlehttp/psr7": "^2.6",
"illuminate/console": "^10.47|^11.0|^12.0|^13.0",
"illuminate/contracts": "^10.47|^11.0|^12.0|^13.0",
"illuminate/http": "^10.47|^11.0|^12.0|^13.0",
"illuminate/support": "^10.47|^11.0|^12.0|^13.0",
"laravel/prompts": "^0.1.15|^0.2.0|^0.3.0",
"php": "^8.2",
"pusher/pusher-php-server": "^7.2",
"ratchet/rfc6455": "^0.4",
"react/promise-timer": "^1.10",
"react/socket": "^1.14",
"symfony/console": "^6.0|^7.0|^8.0",
"symfony/http-foundation": "^6.3|^7.0|^8.0"
},
"require-dev": {
"orchestra/testbench": "^8.36|^9.15|^10.8|^11.0",
"pestphp/pest": "^2.0|^3.0|^4.0",
"phpstan/phpstan": "^1.10",
"ratchet/pawl": "^0.4.1",
"react/async": "^4.2",
"react/http": "^1.9"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Laravel\\Reverb\\ApplicationManagerServiceProvider",
"Laravel\\Reverb\\ReverbServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Laravel\\Reverb\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
},
{
"name": "Joe Dixon",
"email": "joe@laravel.com"
}
],
"description": "Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.",
"keywords": [
"WebSockets",
"laravel",
"real-time",
"websocket"
],
"support": {
"issues": "https://github.com/laravel/reverb/issues",
"source": "https://github.com/laravel/reverb/tree/v1.11.1"
},
"time": "2026-08-06T14:48:58+00:00"
},
{
"name": "laravel/sanctum",
"version": "v3.3.3",
@@ -6061,6 +6317,595 @@
],
"time": "2026-03-24T09:13:16+00:00"
},
{
"name": "ratchet/rfc6455",
"version": "v0.4.1",
"source": {
"type": "git",
"url": "https://github.com/ratchetphp/RFC6455.git",
"reference": "9b05f371219cbaf9748b505f139617dd0715592b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ratchetphp/RFC6455/zipball/9b05f371219cbaf9748b505f139617dd0715592b",
"reference": "9b05f371219cbaf9748b505f139617dd0715592b",
"shasum": ""
},
"require": {
"php": ">=7.4",
"psr/http-factory-implementation": "^1.0",
"symfony/polyfill-php80": "^1.15"
},
"require-dev": {
"guzzlehttp/psr7": "^2.7",
"phpunit/phpunit": "^9.5",
"react/socket": "^1.3"
},
"type": "library",
"autoload": {
"psr-4": {
"Ratchet\\RFC6455\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Chris Boden",
"email": "cboden@gmail.com",
"role": "Developer"
},
{
"name": "Matt Bonneau",
"role": "Developer"
}
],
"description": "RFC6455 WebSocket protocol handler",
"homepage": "http://socketo.me",
"keywords": [
"WebSockets",
"rfc6455",
"websocket"
],
"support": {
"chat": "https://gitter.im/reactphp/reactphp",
"issues": "https://github.com/ratchetphp/RFC6455/issues",
"source": "https://github.com/ratchetphp/RFC6455/tree/v0.4.1"
},
"time": "2026-06-06T14:34:23+00:00"
},
{
"name": "react/cache",
"version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/cache.git",
"reference": "d47c472b64aa5608225f47965a484b75c7817d5b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/cache/zipball/d47c472b64aa5608225f47965a484b75c7817d5b",
"reference": "d47c472b64aa5608225f47965a484b75c7817d5b",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"react/promise": "^3.0 || ^2.0 || ^1.1"
},
"require-dev": {
"phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\Cache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@clue.engineering",
"homepage": "https://clue.engineering/"
},
{
"name": "Cees-Jan Kiewiet",
"email": "reactphp@ceesjankiewiet.nl",
"homepage": "https://wyrihaximus.net/"
},
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com",
"homepage": "https://sorgalla.com/"
},
{
"name": "Chris Boden",
"email": "cboden@gmail.com",
"homepage": "https://cboden.dev/"
}
],
"description": "Async, Promise-based cache interface for ReactPHP",
"keywords": [
"cache",
"caching",
"promise",
"reactphp"
],
"support": {
"issues": "https://github.com/reactphp/cache/issues",
"source": "https://github.com/reactphp/cache/tree/v1.2.0"
},
"funding": [
{
"url": "https://opencollective.com/reactphp",
"type": "open_collective"
}
],
"time": "2022-11-30T15:59:55+00:00"
},
{
"name": "react/dns",
"version": "v1.14.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/dns.git",
"reference": "7562c05391f42701c1fccf189c8225fece1cd7c3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/dns/zipball/7562c05391f42701c1fccf189c8225fece1cd7c3",
"reference": "7562c05391f42701c1fccf189c8225fece1cd7c3",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"react/cache": "^1.0 || ^0.6 || ^0.5",
"react/event-loop": "^1.2",
"react/promise": "^3.2 || ^2.7 || ^1.2.1"
},
"require-dev": {
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36",
"react/async": "^4.3 || ^3 || ^2",
"react/promise-timer": "^1.11"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\Dns\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@clue.engineering",
"homepage": "https://clue.engineering/"
},
{
"name": "Cees-Jan Kiewiet",
"email": "reactphp@ceesjankiewiet.nl",
"homepage": "https://wyrihaximus.net/"
},
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com",
"homepage": "https://sorgalla.com/"
},
{
"name": "Chris Boden",
"email": "cboden@gmail.com",
"homepage": "https://cboden.dev/"
}
],
"description": "Async DNS resolver for ReactPHP",
"keywords": [
"async",
"dns",
"dns-resolver",
"reactphp"
],
"support": {
"issues": "https://github.com/reactphp/dns/issues",
"source": "https://github.com/reactphp/dns/tree/v1.14.0"
},
"funding": [
{
"url": "https://opencollective.com/reactphp",
"type": "open_collective"
}
],
"time": "2025-11-18T19:34:28+00:00"
},
{
"name": "react/event-loop",
"version": "v1.6.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/event-loop.git",
"reference": "ba276bda6083df7e0050fd9b33f66ad7a4ac747a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/event-loop/zipball/ba276bda6083df7e0050fd9b33f66ad7a4ac747a",
"reference": "ba276bda6083df7e0050fd9b33f66ad7a4ac747a",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36"
},
"suggest": {
"ext-pcntl": "For signal handling support when using the StreamSelectLoop"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\EventLoop\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@clue.engineering",
"homepage": "https://clue.engineering/"
},
{
"name": "Cees-Jan Kiewiet",
"email": "reactphp@ceesjankiewiet.nl",
"homepage": "https://wyrihaximus.net/"
},
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com",
"homepage": "https://sorgalla.com/"
},
{
"name": "Chris Boden",
"email": "cboden@gmail.com",
"homepage": "https://cboden.dev/"
}
],
"description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.",
"keywords": [
"asynchronous",
"event-loop"
],
"support": {
"issues": "https://github.com/reactphp/event-loop/issues",
"source": "https://github.com/reactphp/event-loop/tree/v1.6.0"
},
"funding": [
{
"url": "https://opencollective.com/reactphp",
"type": "open_collective"
}
],
"time": "2025-11-17T20:46:25+00:00"
},
{
"name": "react/promise",
"version": "v3.3.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/promise.git",
"reference": "23444f53a813a3296c1368bb104793ce8d88f04a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/promise/zipball/23444f53a813a3296c1368bb104793ce8d88f04a",
"reference": "23444f53a813a3296c1368bb104793ce8d88f04a",
"shasum": ""
},
"require": {
"php": ">=7.1.0"
},
"require-dev": {
"phpstan/phpstan": "1.12.28 || 1.4.10",
"phpunit/phpunit": "^9.6 || ^7.5"
},
"type": "library",
"autoload": {
"files": [
"src/functions_include.php"
],
"psr-4": {
"React\\Promise\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com",
"homepage": "https://sorgalla.com/"
},
{
"name": "Christian Lück",
"email": "christian@clue.engineering",
"homepage": "https://clue.engineering/"
},
{
"name": "Cees-Jan Kiewiet",
"email": "reactphp@ceesjankiewiet.nl",
"homepage": "https://wyrihaximus.net/"
},
{
"name": "Chris Boden",
"email": "cboden@gmail.com",
"homepage": "https://cboden.dev/"
}
],
"description": "A lightweight implementation of CommonJS Promises/A for PHP",
"keywords": [
"promise",
"promises"
],
"support": {
"issues": "https://github.com/reactphp/promise/issues",
"source": "https://github.com/reactphp/promise/tree/v3.3.0"
},
"funding": [
{
"url": "https://opencollective.com/reactphp",
"type": "open_collective"
}
],
"time": "2025-08-19T18:57:03+00:00"
},
{
"name": "react/promise-timer",
"version": "v1.11.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/promise-timer.git",
"reference": "4f70306ed66b8b44768941ca7f142092600fafc1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/promise-timer/zipball/4f70306ed66b8b44768941ca7f142092600fafc1",
"reference": "4f70306ed66b8b44768941ca7f142092600fafc1",
"shasum": ""
},
"require": {
"php": ">=5.3",
"react/event-loop": "^1.2",
"react/promise": "^3.2 || ^2.7.0 || ^1.2.1"
},
"require-dev": {
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36"
},
"type": "library",
"autoload": {
"files": [
"src/functions_include.php"
],
"psr-4": {
"React\\Promise\\Timer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@clue.engineering",
"homepage": "https://clue.engineering/"
},
{
"name": "Cees-Jan Kiewiet",
"email": "reactphp@ceesjankiewiet.nl",
"homepage": "https://wyrihaximus.net/"
},
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com",
"homepage": "https://sorgalla.com/"
},
{
"name": "Chris Boden",
"email": "cboden@gmail.com",
"homepage": "https://cboden.dev/"
}
],
"description": "A trivial implementation of timeouts for Promises, built on top of ReactPHP.",
"homepage": "https://github.com/reactphp/promise-timer",
"keywords": [
"async",
"event-loop",
"promise",
"reactphp",
"timeout",
"timer"
],
"support": {
"issues": "https://github.com/reactphp/promise-timer/issues",
"source": "https://github.com/reactphp/promise-timer/tree/v1.11.0"
},
"funding": [
{
"url": "https://opencollective.com/reactphp",
"type": "open_collective"
}
],
"time": "2024-06-04T14:27:45+00:00"
},
{
"name": "react/socket",
"version": "v1.17.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/socket.git",
"reference": "ef5b17b81f6f60504c539313f94f2d826c5faa08"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/socket/zipball/ef5b17b81f6f60504c539313f94f2d826c5faa08",
"reference": "ef5b17b81f6f60504c539313f94f2d826c5faa08",
"shasum": ""
},
"require": {
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
"php": ">=5.3.0",
"react/dns": "^1.13",
"react/event-loop": "^1.2",
"react/promise": "^3.2 || ^2.6 || ^1.2.1",
"react/stream": "^1.4"
},
"require-dev": {
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36",
"react/async": "^4.3 || ^3.3 || ^2",
"react/promise-stream": "^1.4",
"react/promise-timer": "^1.11"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\Socket\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@clue.engineering",
"homepage": "https://clue.engineering/"
},
{
"name": "Cees-Jan Kiewiet",
"email": "reactphp@ceesjankiewiet.nl",
"homepage": "https://wyrihaximus.net/"
},
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com",
"homepage": "https://sorgalla.com/"
},
{
"name": "Chris Boden",
"email": "cboden@gmail.com",
"homepage": "https://cboden.dev/"
}
],
"description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP",
"keywords": [
"Connection",
"Socket",
"async",
"reactphp",
"stream"
],
"support": {
"issues": "https://github.com/reactphp/socket/issues",
"source": "https://github.com/reactphp/socket/tree/v1.17.0"
},
"funding": [
{
"url": "https://opencollective.com/reactphp",
"type": "open_collective"
}
],
"time": "2025-11-19T20:47:34+00:00"
},
{
"name": "react/stream",
"version": "v1.4.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/stream.git",
"reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/stream/zipball/1e5b0acb8fe55143b5b426817155190eb6f5b18d",
"reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d",
"shasum": ""
},
"require": {
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
"php": ">=5.3.8",
"react/event-loop": "^1.2"
},
"require-dev": {
"clue/stream-filter": "~1.2",
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\Stream\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@clue.engineering",
"homepage": "https://clue.engineering/"
},
{
"name": "Cees-Jan Kiewiet",
"email": "reactphp@ceesjankiewiet.nl",
"homepage": "https://wyrihaximus.net/"
},
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com",
"homepage": "https://sorgalla.com/"
},
{
"name": "Chris Boden",
"email": "cboden@gmail.com",
"homepage": "https://cboden.dev/"
}
],
"description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP",
"keywords": [
"event-driven",
"io",
"non-blocking",
"pipe",
"reactphp",
"readable",
"stream",
"writable"
],
"support": {
"issues": "https://github.com/reactphp/stream/issues",
"source": "https://github.com/reactphp/stream/tree/v1.4.0"
},
"funding": [
{
"url": "https://opencollective.com/reactphp",
"type": "open_collective"
}
],
"time": "2024-06-11T12:45:25+00:00"
},
{
"name": "shuvroroy/nova-tabs",
"version": "v1.1.1",
+18 -1
View File
@@ -11,7 +11,7 @@
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "ably", "redis", "log", "null"
| Supported: "reverb", "pusher", "ably", "redis", "log", "null"
|
*/
@@ -30,6 +30,23 @@
'connections' => [
'reverb' => [
'driver' => 'reverb',
'key' => env('REVERB_APP_KEY'),
'secret' => env('REVERB_APP_SECRET'),
'app_id' => env('REVERB_APP_ID'),
'options' => [
'host' => env('REVERB_HOST'),
'port' => env('REVERB_PORT', 443),
'scheme' => env('REVERB_SCHEME', 'https'),
'useTLS' => env('REVERB_SCHEME', 'https') === 'https',
'path' => env('REVERB_SERVER_PATH', ''),
],
'client_options' => [
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
],
],
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
+17
View File
@@ -0,0 +1,17 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Support user
|--------------------------------------------------------------------------
|
| Storefront chat always opens a 1:1 conversation with this user. Nova
| staff (admin / manager / direktor) operate this inbox on their behalf.
|
*/
'support_user_id' => (int) env('CHAT_SUPPORT_USER_ID', 0),
];
+1 -1
View File
@@ -15,7 +15,7 @@
|
*/
'paths' => ['api/*', 'sanctum/csrf-cookie'],
'paths' => ['api/*', 'sanctum/csrf-cookie', 'broadcasting/auth'],
'allowed_methods' => ['*'],
+102
View File
@@ -0,0 +1,102 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Reverb Server
|--------------------------------------------------------------------------
|
| This option controls the default server used by Reverb to handle
| incoming messages as well as broadcasting message to all your
| connected clients. At this time only "reverb" is supported.
|
*/
'default' => env('REVERB_SERVER', 'reverb'),
/*
|--------------------------------------------------------------------------
| Reverb Servers
|--------------------------------------------------------------------------
|
| Here you may define details for each of the supported Reverb servers.
| Each server has its own configuration options that are defined in
| the array below. You should ensure all the options are present.
|
*/
'servers' => [
'reverb' => [
'host' => env('REVERB_SERVER_HOST', '0.0.0.0'),
'port' => env('REVERB_SERVER_PORT', 8080),
'path' => env('REVERB_SERVER_PATH', ''),
'hostname' => env('REVERB_HOST'),
'options' => [
'tls' => [],
],
'max_request_size' => env('REVERB_MAX_REQUEST_SIZE', 10_000),
'scaling' => [
'enabled' => env('REVERB_SCALING_ENABLED', false),
'channel' => env('REVERB_SCALING_CHANNEL', 'reverb'),
'server' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'port' => env('REDIS_PORT', '6379'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'database' => env('REDIS_DB', '0'),
'timeout' => env('REDIS_TIMEOUT', 60),
],
],
'pulse_ingest_interval' => env('REVERB_PULSE_INGEST_INTERVAL', 15),
'telescope_ingest_interval' => env('REVERB_TELESCOPE_INGEST_INTERVAL', 15),
],
],
/*
|--------------------------------------------------------------------------
| Reverb Applications
|--------------------------------------------------------------------------
|
| Here you may define how Reverb applications are managed. If you choose
| to use the "config" provider, you may define an array of apps which
| your server will support, including their connection credentials.
|
*/
'apps' => [
'provider' => 'config',
'apps' => [
[
'key' => env('REVERB_APP_KEY'),
'secret' => env('REVERB_APP_SECRET'),
'app_id' => env('REVERB_APP_ID'),
'options' => [
'host' => env('REVERB_HOST'),
'port' => env('REVERB_PORT', 443),
'scheme' => env('REVERB_SCHEME', 'https'),
'useTLS' => env('REVERB_SCHEME', 'https') === 'https',
],
'allowed_origins' => ['*'],
'ping_interval' => env('REVERB_APP_PING_INTERVAL', 60),
'activity_timeout' => env('REVERB_APP_ACTIVITY_TIMEOUT', 30),
'max_connections' => env('REVERB_APP_MAX_CONNECTIONS'),
'max_message_size' => env('REVERB_APP_MAX_MESSAGE_SIZE', 10_000),
'accept_client_events_from' => env('REVERB_APP_ACCEPT_CLIENT_EVENTS_FROM', 'members'),
'rate_limiting' => [
'enabled' => env('REVERB_APP_RATE_LIMITING_ENABLED', false),
'max_attempts' => env('REVERB_APP_RATE_LIMIT_MAX_ATTEMPTS', 60),
'decay_seconds' => env('REVERB_APP_RATE_LIMIT_DECAY_SECONDS', 60),
'terminate_on_limit' => env('REVERB_APP_RATE_LIMIT_TERMINATE', false),
],
],
],
],
];
@@ -1,47 +0,0 @@
<?php
declare(strict_types=1);
use BasementChat\Basement\Enums\MessageType;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('private_messages', static function (Blueprint $table): void {
/** @var string $model */
$model = config('basement.user_model');
/** @var Model $user */
$user = app($model);
$primaryKey = $user->getKeyName();
$tableName = $user->getTable();
$table->id();
$table->unsignedBigInteger('receiver_id');
$table->unsignedBigInteger('sender_id');
$table->foreign('receiver_id')->references($primaryKey)->on($tableName);
$table->foreign('sender_id')->references($primaryKey)->on($tableName);
$table->enum('type', [MessageType::document()->value, MessageType::text()->value]);
$table->string('value');
$table->timestamp('read_at')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('private_messages');
}
};
@@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::dropIfExists('private_messages');
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// Basement Chat leftovers are not restored.
}
};
+256
View File
@@ -0,0 +1,256 @@
*,
*::before,
*::after {
box-sizing: border-box;
}
html,
body {
margin: 0;
height: 100%;
font-family: Nunito, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
background: #0f172a;
color: #0f172a;
}
.mm-chat {
display: flex;
flex-direction: column;
height: 100%;
min-height: 100vh;
}
.mm-chat__top {
display: flex;
align-items: center;
gap: 16px;
padding: 12px 20px;
background: #1e293b;
color: #f8fafc;
flex-shrink: 0;
}
.mm-chat__top h1 {
margin: 0;
font-size: 18px;
font-weight: 700;
}
.mm-chat__back {
color: #cbd5e1;
text-decoration: none;
font-size: 13px;
}
.mm-chat__back:hover {
color: #fff;
}
.mm-chat__badge {
margin-left: auto;
min-width: 22px;
height: 22px;
padding: 0 7px;
border-radius: 999px;
background: #d32824;
color: #fff;
font-size: 12px;
line-height: 22px;
text-align: center;
font-weight: 700;
}
.mm-chat__shell {
display: grid;
grid-template-columns: 320px 1fr;
flex: 1;
min-height: 0;
background: #e2e8f0;
}
.mm-chat__inbox {
display: flex;
flex-direction: column;
background: #fff;
border-right: 1px solid #e2e8f0;
min-height: 0;
}
.mm-chat__inbox-head {
padding: 14px 16px;
font-size: 12px;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
color: #64748b;
border-bottom: 1px solid #e2e8f0;
}
.mm-chat__list {
overflow-y: auto;
flex: 1;
}
.mm-chat__empty {
margin: 24px 16px;
color: #94a3b8;
font-size: 13px;
}
.mm-chat__item {
display: block;
width: 100%;
text-align: left;
border: 0;
border-bottom: 1px solid #f1f5f9;
background: #fff;
padding: 12px 16px;
cursor: pointer;
}
.mm-chat__item:hover,
.mm-chat__item.is-active {
background: #f8fafc;
}
.mm-chat__item-row {
display: flex;
justify-content: space-between;
gap: 8px;
align-items: center;
}
.mm-chat__item-name {
font-weight: 700;
font-size: 14px;
color: #0f172a;
}
.mm-chat__item-time {
font-size: 11px;
color: #94a3b8;
white-space: nowrap;
}
.mm-chat__item-preview {
margin-top: 4px;
font-size: 13px;
color: #64748b;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.mm-chat__item-phone {
font-size: 12px;
color: #94a3b8;
}
.mm-chat__item-unread {
display: inline-flex;
min-width: 18px;
height: 18px;
margin-top: 6px;
padding: 0 6px;
border-radius: 999px;
background: #d32824;
color: #fff;
font-size: 11px;
font-weight: 700;
align-items: center;
justify-content: center;
}
.mm-chat__thread {
display: flex;
flex-direction: column;
min-width: 0;
min-height: 0;
}
.mm-chat__thread-head {
padding: 14px 20px;
background: #fff;
border-bottom: 1px solid #e2e8f0;
font-weight: 700;
font-size: 15px;
}
.mm-chat__messages {
flex: 1;
overflow-y: auto;
padding: 20px;
display: flex;
flex-direction: column;
gap: 10px;
}
.mm-chat__bubble {
max-width: 72%;
padding: 10px 12px;
border-radius: 14px;
font-size: 14px;
line-height: 1.45;
white-space: pre-wrap;
word-break: break-word;
}
.mm-chat__bubble--in {
align-self: flex-start;
background: #fff;
color: #0f172a;
}
.mm-chat__bubble--out {
align-self: flex-end;
background: #d32824;
color: #fff;
}
.mm-chat__meta {
display: block;
margin-top: 4px;
font-size: 11px;
opacity: 0.7;
}
.mm-chat__composer {
display: flex;
gap: 10px;
padding: 12px 16px;
background: #fff;
border-top: 1px solid #e2e8f0;
}
.mm-chat__composer textarea {
flex: 1;
resize: none;
border: 1px solid #cbd5e1;
border-radius: 10px;
padding: 10px 12px;
font: inherit;
min-height: 44px;
max-height: 140px;
}
.mm-chat__composer button {
border: 0;
border-radius: 10px;
background: #d32824;
color: #fff;
font-weight: 700;
padding: 0 18px;
cursor: pointer;
}
.mm-chat__composer button:disabled {
opacity: 0.55;
cursor: not-allowed;
}
@media (max-width: 800px) {
.mm-chat__shell {
grid-template-columns: 1fr;
grid-template-rows: 40% 1fr;
}
}
+359
View File
@@ -0,0 +1,359 @@
(function () {
const config = window.MM_CHAT || {};
const listEl = document.getElementById("mm-chat-list");
const emptyInboxEl = document.getElementById("mm-chat-empty-inbox");
const messagesEl = document.getElementById("mm-chat-messages");
const headEl = document.getElementById("mm-chat-thread-head");
const formEl = document.getElementById("mm-chat-form");
const inputEl = document.getElementById("mm-chat-input");
const sendEl = document.getElementById("mm-chat-send");
const unreadEl = document.getElementById("mm-chat-unread");
const state = {
conversations: [],
activeId: null,
messages: [],
nextPageUrl: null,
loadingMessages: false,
echo: null,
};
function headers(json) {
const next = {
Accept: "application/json",
"X-CSRF-TOKEN": config.csrf,
"X-Requested-With": "XMLHttpRequest",
};
if (json) {
next["Content-Type"] = "application/json";
}
return next;
}
async function request(url, options) {
const response = await fetch(url, options);
if (!response.ok) {
throw new Error("Chat request failed");
}
return response.json();
}
function formatTime(value) {
if (!value) {
return "";
}
const date = new Date(value);
if (Number.isNaN(date.getTime())) {
return "";
}
const pad = (n) => String(n).padStart(2, "0");
return `${pad(date.getHours())}:${pad(date.getMinutes())}, ${pad(date.getDate())}.${pad(date.getMonth() + 1)}.${date.getFullYear()}`;
}
function preview(body) {
if (!body) {
return "";
}
return body.length > 80 ? `${body.slice(0, 80)}…` : body;
}
function updateUnreadBadge() {
const total = state.conversations.reduce(
(sum, conversation) => sum + (conversation.unread_count || 0),
0
);
unreadEl.textContent = String(total);
unreadEl.hidden = total < 1;
}
function renderInbox() {
listEl.innerHTML = "";
emptyInboxEl.hidden = state.conversations.length > 0;
state.conversations.forEach((conversation) => {
const button = document.createElement("button");
button.type = "button";
button.className = "mm-chat__item";
if (conversation.id === state.activeId) {
button.classList.add("is-active");
}
const name = (conversation.user && conversation.user.name) || `#${conversation.id}`;
const phone = conversation.user && conversation.user.phone_number;
const last = conversation.last_message;
const time = last ? formatTime(last.created_at) : "";
button.innerHTML = `
<div class="mm-chat__item-row">
<span class="mm-chat__item-name"></span>
<span class="mm-chat__item-time"></span>
</div>
${phone ? '<div class="mm-chat__item-phone"></div>' : ""}
<div class="mm-chat__item-preview"></div>
${conversation.unread_count ? '<span class="mm-chat__item-unread"></span>' : ""}
`;
button.querySelector(".mm-chat__item-name").textContent = name;
button.querySelector(".mm-chat__item-time").textContent = time;
if (phone) {
button.querySelector(".mm-chat__item-phone").textContent = String(phone);
}
button.querySelector(".mm-chat__item-preview").textContent = last
? preview(last.body)
: "";
const unread = button.querySelector(".mm-chat__item-unread");
if (unread) {
unread.textContent = String(conversation.unread_count);
}
button.addEventListener("click", () => openConversation(conversation.id));
listEl.appendChild(button);
});
updateUnreadBadge();
}
function isOutgoing(message, conversation) {
const otherId = conversation && conversation.user && conversation.user.id;
return !otherId || message.user?.id !== otherId;
}
function renderMessages() {
const conversation = state.conversations.find((item) => item.id === state.activeId);
messagesEl.innerHTML = "";
if (!state.messages.length) {
const empty = document.createElement("p");
empty.className = "mm-chat__empty";
empty.textContent = config.strings.noMessages;
messagesEl.appendChild(empty);
return;
}
state.messages.forEach((message) => {
const bubble = document.createElement("div");
bubble.className = `mm-chat__bubble ${
isOutgoing(message, conversation) ? "mm-chat__bubble--out" : "mm-chat__bubble--in"
}`;
const body = document.createElement("div");
body.textContent = message.body;
const meta = document.createElement("span");
meta.className = "mm-chat__meta";
meta.textContent = formatTime(message.created_at);
bubble.appendChild(body);
bubble.appendChild(meta);
messagesEl.appendChild(bubble);
});
messagesEl.scrollTop = messagesEl.scrollHeight;
}
async function loadInbox() {
const payload = await request(config.conversationsUrl, { headers: headers() });
state.conversations = payload.data || [];
renderInbox();
}
async function loadMessages(conversationId, reset) {
if (state.loadingMessages) {
return;
}
state.loadingMessages = true;
const url = reset
? `${config.messagesUrl}/${conversationId}/messages?perPage=50`
: state.nextPageUrl;
if (!url) {
state.loadingMessages = false;
return;
}
try {
const payload = await request(url, { headers: headers() });
const items = (payload.data || []).slice().reverse();
state.nextPageUrl = payload.pagination && payload.pagination.next_page_url;
if (reset) {
state.messages = items;
} else {
state.messages = items.concat(state.messages);
}
renderMessages();
} finally {
state.loadingMessages = false;
}
}
async function markRead(conversationId) {
await request(`${config.messagesUrl}/${conversationId}/read`, {
method: "POST",
headers: headers(true),
});
const conversation = state.conversations.find((item) => item.id === conversationId);
if (conversation) {
conversation.unread_count = 0;
renderInbox();
}
}
async function openConversation(conversationId) {
state.activeId = conversationId;
const conversation = state.conversations.find((item) => item.id === conversationId);
const name = (conversation && conversation.user && conversation.user.name) || `#${conversationId}`;
const phone = conversation && conversation.user && conversation.user.phone_number;
headEl.textContent = phone ? `${name} · ${phone}` : name;
formEl.hidden = false;
renderInbox();
await loadMessages(conversationId, true);
await markRead(conversationId);
subscribeThread(conversationId);
}
async function sendMessage(event) {
event.preventDefault();
const body = (inputEl.value || "").trim();
if (!body || !state.activeId) {
return;
}
sendEl.disabled = true;
try {
const payload = await request(
`${config.messagesUrl}/${state.activeId}/messages`,
{
method: "POST",
headers: headers(true),
body: JSON.stringify({ body }),
}
);
const message = payload.data;
if (message && !state.messages.some((item) => item.id === message.id)) {
state.messages.push(message);
renderMessages();
}
inputEl.value = "";
await loadInbox();
} finally {
sendEl.disabled = false;
inputEl.focus();
}
}
function upsertIncoming(message) {
if (!message || !message.conversation_id) {
return;
}
if (state.activeId === message.conversation_id) {
if (!state.messages.some((item) => item.id === message.id)) {
state.messages.push(message);
renderMessages();
}
markRead(message.conversation_id);
}
loadInbox();
}
function subscribeThread(conversationId) {
if (!state.echo) {
return;
}
state.echo.private(`chat.${conversationId}`).listen(".message.sent", upsertIncoming);
}
function bootEcho() {
const pusher = config.pusher || {};
const EchoClass = window.Echo;
if (typeof EchoClass !== "function" || !window.Pusher || !pusher.key) {
return;
}
const scheme = pusher.scheme || "https";
const forceTLS = scheme === "https";
try {
state.echo = new EchoClass({
broadcaster: "reverb",
key: pusher.key,
wsHost: pusher.host || undefined,
wsPort: pusher.port || undefined,
wssPort: pusher.port || undefined,
forceTLS,
enabledTransports: ["ws", "wss"],
disableStats: true,
cluster: "mt1",
authEndpoint: config.broadcastAuth,
auth: {
headers: {
"X-CSRF-TOKEN": config.csrf,
Accept: "application/json",
},
},
});
state.echo.private("chat.support").listen(".message.sent", upsertIncoming);
} catch (err) {
state.echo = null;
}
}
async function mergeActiveMessages() {
if (!state.activeId || state.loadingMessages) {
return;
}
const payload = await request(
`${config.messagesUrl}/${state.activeId}/messages?perPage=50`,
{ headers: headers() }
);
const items = (payload.data || []).slice().reverse();
const known = new Set(state.messages.map((item) => item.id));
let added = false;
items.forEach((message) => {
if (!known.has(message.id)) {
state.messages.push(message);
added = true;
}
});
if (added) {
state.messages.sort(
(a, b) => new Date(a.created_at) - new Date(b.created_at)
);
renderMessages();
}
}
formEl.addEventListener("submit", sendMessage);
inputEl.addEventListener("keydown", (event) => {
if (event.key === "Enter" && !event.shiftKey) {
event.preventDefault();
formEl.requestSubmit();
}
});
messagesEl.addEventListener("scroll", () => {
if (messagesEl.scrollTop < 40 && state.nextPageUrl && state.activeId) {
const previousHeight = messagesEl.scrollHeight;
loadMessages(state.activeId, false).then(() => {
messagesEl.scrollTop = messagesEl.scrollHeight - previousHeight;
});
}
});
loadInbox();
bootEcho();
setInterval(() => {
loadInbox().then(() => {
if (state.activeId) {
mergeActiveMessages();
}
});
}, 4000);
})();
-3
View File
@@ -1,3 +0,0 @@
/*
! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com
*/.basement *,.basement :after,.basement :before{border:0 solid #e5e7eb;box-sizing:border-box}.basement :after,.basement :before{--tw-content:""}.basement{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:Nunito,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;line-height:inherit;margin:0;-moz-tab-size:4;-o-tab-size:4;tab-size:4}.basement hr{border-top-width:1px;color:inherit;height:0}.basement abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.basement h1,.basement h2,.basement h3,.basement h4,.basement h5,.basement h6{font-size:inherit;font-weight:inherit}.basement a{color:inherit;text-decoration:inherit}.basement b,.basement strong{font-weight:bolder}.basement code,.basement kbd,.basement pre,.basement samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}.basement small{font-size:80%}.basement sub,.basement sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.basement sub{bottom:-.25em}.basement sup{top:-.5em}.basement table{border-collapse:collapse;border-color:inherit;text-indent:0}.basement button,.basement input,.basement optgroup,.basement select,.basement textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}.basement button,.basement select{text-transform:none}.basement [type=button],.basement [type=reset],.basement [type=submit],.basement button{-webkit-appearance:button;background-color:transparent;background-image:none}.basement :-moz-focusring{outline:auto}.basement :-moz-ui-invalid{box-shadow:none}.basement progress{vertical-align:baseline}.basement ::-webkit-inner-spin-button,.basement ::-webkit-outer-spin-button{height:auto}.basement [type=search]{-webkit-appearance:textfield;outline-offset:-2px}.basement ::-webkit-search-decoration{-webkit-appearance:none}.basement ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}.basement summary{display:list-item}.basement blockquote,.basement dd,.basement dl,.basement figure,.basement h1,.basement h2,.basement h3,.basement h4,.basement h5,.basement h6,.basement hr,.basement p,.basement pre{margin:0}.basement fieldset{margin:0;padding:0}.basement legend{padding:0}.basement menu,.basement ol,.basement ul{list-style:none;margin:0;padding:0}.basement textarea{resize:vertical}.basement input::-moz-placeholder,.basement textarea::-moz-placeholder{color:#9ca3af;opacity:1}.basement input::placeholder,.basement textarea::placeholder{color:#9ca3af;opacity:1}.basement [role=button],.basement button{cursor:pointer}.basement :disabled{cursor:default}.basement audio,.basement canvas,.basement embed,.basement iframe,.basement img,.basement object,.basement svg,.basement video{display:block;vertical-align:middle}.basement img,.basement video{height:auto;max-width:100%}.basement [hidden]{display:none}.basement *,.basement :after,.basement :before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.basement ::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur:Line truncated
-47
View File
@@ -1,47 +0,0 @@
!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";var t,e,n,r,i=!1,o=!1,a=[],s=-1;function u(t){!function(t){a.includes(t)||a.push(t);o||i||(i=!0,queueMicrotask(l))}(t)}function c(t){let e=a.indexOf(t);-1!==e&&e>s&&a.splice(e,1)}function l(){i=!1,o=!0;for(let t=0;t<a.length;t++)a[t](),s=t;a.length=0,s=-1,o=!1}var f=!0;function h(t){e=t}var d=[],p=[],v=[];function g(t,e){"function"==typeof e?(t._x_cleanups||(t._x_cleanups=[]),t._x_cleanups.push(e)):(e=t,p.push(e))}function y(t,e){t._x_attributeCleanups&&Object.entries(t._x_attributeCleanups).forEach((([n,r])=>{(void 0===e||e.includes(n))&&(r.forEach((t=>t())),delete t._x_attributeCleanups[n])}))}var m=new MutationObserver(T),b=!1;function w(){m.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),b=!0}function _(){(x=x.concat(m.takeRecords())).length&&!E&&(E=!0,queueMicrotask((()=>{T(x),x.length=0,E=!1}))),m.disconnect(),b=!1}var x=[],E=!1;function S(t){if(!b)return t();_();let e=t();return w(),e}var O=!1,k=[];function T(t){if(O)return void(k=k.concat(t));let e=[],n=[],r=new Map,i=new Map;for(let o=0;o<t.length;o++)if(!t[o].target._x_ignoreMutationObserver&&("childList"===t[o].type&&(t[o].addedNodes.forEach((t=>1===t.nodeType&&e.push(t))),t[o].removedNodes.forEach((t=>1===t.nodeType&&n.push(t)))),"attributes"===t[o].type)){let e=t[o].target,n=t[o].attributeName,a=t[o].oldValue,s=()=>{r.has(e)||r.set(e,[]),r.get(e).push({name:n,value:e.getAttribute(n)})},u=()=>{i.has(e)||i.set(e,[]),i.get(e).push(n)};e.hasAttribute(n)&&null===a?s():e.hasAttribute(n)?(u(),s()):u()}i.forEach(((t,e)=>{y(e,t)})),r.forEach(((t,e)=>{d.forEach((n=>n(e,t)))}));for(let t of n)if(!e.includes(t)&&(p.forEach((e=>e(t))),t._x_cleanups))for(;t._x_cleanups.length;)t._x_cleanups.pop()();e.forEach((t=>{t._x_ignoreSelf=!0,t._x_ignore=!0}));for(let t of e)n.includes(t)||t.isConnected&&(delete t._x_ignoreSelf,delete t._x_ignore,v.forEach((e=>e(t))),t._x_ignore=!0,t._x_ignoreSelf=!0);e.forEach((t=>{delete t._x_ignoreSelf,delete t._x_ignore})),e=null,n=null,r=null,i=null}function P(t){return j(A(t))}function C(t,e,n){return t._x_dataStack=[e,...A(n||t)],()=>{t._x_dataStack=t._x_dataStack.filter((t=>t!==e))}}function A(t){return t._x_dataStack?t._x_dataStack:"function"==typeof ShadowRoot&&t instanceof ShadowRoot?A(t.host):t.parentNode?A(t.parentNode):[]}function j(t){let e=new Proxy({},{ownKeys:()=>Array.from(new Set(t.flatMap((t=>Object.keys(t))))),has:(e,n)=>t.some((t=>t.hasOwnProperty(n))),get:(n,r)=>(t.find((t=>{if(t.hasOwnProperty(r)){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get&&n.get._x_alreadyBound||n.set&&n.set._x_alreadyBound)return!0;if((n.get||n.set)&&n.enumerable){let i=n.get,o=n.set,a=n;i=i&&i.bind(e),o=o&&o.bind(e),i&&(i._x_alreadyBound=!0),o&&(o._x_alreadyBound=!0),Object.defineProperty(t,r,{...a,get:i,set:o})}return!0}return!1}))||{})[r],set:(e,n,r)=>{let i=t.find((t=>t.hasOwnProperty(n)));return i?i[n]=r:t[t.length-1][n]=r,!0}});return e}function N(t){let e=(n,r="")=>{Object.entries(Object.getOwnPropertyDescriptors(n)).forEach((([i,{value:o,enumerable:a}])=>{if(!1===a||void 0===o)return;let s=""===r?i:`${r}.${i}`;var u;"object"==typeof o&&null!==o&&o._x_interceptor?n[i]=o.initialize(t,s,i):"object"!=typeof(u=o)||Array.isArray(u)||null===u||o===n||o instanceof Element||e(o,s)}))};return e(t)}function M(t,e=(()=>{})){let n={initialValue:void 0,_x_interceptor:!0,initialize(e,n,r){return t(this.initialValue,(()=>function(t,e){return e.split(".").reduce(((t,e)=>t[e]),t)}(e,n)),(t=>R(e,n,t)),n,r)}};return e(n),t=>{if("object"==typeof t&&null!==t&&t._x_interceptor){let e=n.initialize.bind(n);n.initialize=(r,i,o)=>{let a=t.initialize(r,i,o);return n.initialValue=a,e(r,i,o)}}else n.initialValue=t;return n}}function R(t,e,n){if("string"==typeof e&&(e=e.split(".")),1!==e.length){if(0===e.length)throw error;return t[e[0]]||(t[e[0]]={}),R(t[e[0]],e.slice(1),n)}t[e[0]]=n}var D={};function L(t,e){D[t]=e}function I(t,e){return Object.entries(D).forEach((([n,r])=>{let i=null;Object.defineProperty(t,`$${n}`,{get:()=>r(e,function(){if(i)return i;{let[t,n]=nt(e);return i={interceptor:M,...t},g(e,n),i}}()),enumerable:!1})})),t}function U(t,e,n,...r){try{return n(...r)}catch(n){F(n,t,e)}}function F(t,e,n=void 0){Object.assign(t,{el:e,expression:n}),console.warn(`Alpine Expression Error: ${t.message}\n\n${n?'Expression: "'+n+'"\n\n':""}`,e),setTimeout((()=>{throw t}),0)}var B=!0;function z(t,e,n={}){let r;return q(t,e)((t=>r=t),n),r}function q(...t){return H(...t)}var H=W;function W(t,e){let n={};I(n,t);let r=[n,...A(t)],i="function"==typeof e?function(t,e){return(n=(()=>{}),{scope:r={},params:i=[]}={})=>{$(n,e.apply(j([r,...t]),i))}}(r,e):function(t,e,n){let r=function(t,e){if(Y[t])return Y[t];let n=Object.getPrototypeOf((async function(){})).constructor,r=/^[\n\s]*if.*\(.*\)/.test(t)||/^(let|const)\s/.test(t)?`(async()=>{ ${t} })()`:t;const i=()=>{try{return new n(["__self","scope"],`with (scope) { __self.result = ${r} }; __self Line truncated
/**
* @license
*
* Push v1.0.9
* =========
* A compact, cross-browser solution for the JavaScript Notifications API
*
* Credits
* -------
* Tsvetan Tsvetkov (ttsvetko)
* Alex Gibson (alexgibson)
*
* License
* -------
*
* The MIT License (MIT)
*
* Copyright (c) 2015-2017 Tyler Nickerson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
!function(t,e){t.exports=function(){var t={errors:{incompatible:"".concat("PushError:"," Push.js is incompatible with browser."),invalid_plugin:"".concat("PushError:"," plugin class missing from plugin manifest (invalid plugin). Please check the documentation."),invalid_title:"".concat("PushError:"," title of notification must be a string"),permission_denied:"".concat("PushError:"," permission request declined"),sw_notification_error:"".concat("PushError:"," could not show a ServiceWorker notification due to the following reason: "),sw_registration_error:"".concat("PushError:"," could not register the ServiceWorker due to the following reason: "),unknown_interface:"".concat("PushError:"," unable to create notification: unknown interface")}};function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&s(t,e)}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}var c=function(){function t(e){n(this,t),this._win=e,this.GRANTED="granted",this.DEFAULT="default",this.DENIED="denied",this._permissions=[this.GRANTED,this.DEFAULT,this.DENIED]}return i(t,[{key:"request",value:function(t,e){return arguments.length>0?this._requestWithCallback.apply(this,arguments):this._requestAsPromise()}},{key:"_requestWithCallback",value:function(t,e){var n,r=this,i=this.get(),o=!1,a=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r._win.Notification.permission;o||(o=!0,void 0===n&&r._win.webkitNotifications&&(n=r._win.webkitNotifications.checkPermission()),n===r.GRANTED||0===n?t&&t():e&&e())};i!==this.DEFAULT?a(i):this._win.webkitNotifications&&this._win.webkitNotifications.checkPermission?this._win.webkitNotifications.requestPermission(a):this._win.Notification&&this._win.Notification.requestPermission?(n=this._win.Notification.requestPermission(a))&&n.then&&n.then(a).catch((function(){e&&e()})):t&&t()}},{key:"_requestAsPromise",value:function(){var t=this,e=this.get(),n=e!==this.DEFAULT,r=this._win.Notification&&this._win.Notification.requestPermission,i=this._win.webkitNotifications&&this._win.webkitNotifications.checkPermission;return new Promise((function(o,a){var s,u=!1,c=function(e){u||(u=!0,function(e){return e===t.GRANTED||0===e}(e)?o():a())};n?c(e):i?t._win.webkitNotifications.requestPermission((function(t){c(t)})):r?(s=t._win.Notification.requestPermission(c))&&s.then&&s.then(c).catch(a):o()}))}},{key:"has",value:function(){return this.get()===this.GRANTED}},{key:"get",value:function(){return this._win.Notification&&this._win.Notification.permission?this._win.Notification.permission:this._win.webkitNotifications&&this._win.webkitNotifications.checkPermission?this._permissions[this._win.webkitNotifications.checkPermission()]:navigator.mozNotification?this.GRANTED:this._win.external&&this._win.external.msIsSiteMode?this._win.external.msIsSiteMode()?this.GRANTED:this.DEFAULT:this.GRANTED}}]),t}(),l=function(){function t(){n(this,t)}return i(t,null,[{key:"isUndefined",value:function(t){return void 0===t}},{key:"isNull",value:function(t){return null===obj}},{key:"isString",value:function(t){return"string"==typeof t}},{key:"isFunction",value:function(t){return t&&"[object Function]"==={}.toString.call(t)}},{key:"isObject",value:function(t){return"object"===e(t)}},{key:"objectMerge",value:function(t,e){for(var n in e)t.hasOwnProperty(n)&&this.isObject(t[n])&&this.isObject(e[n])?this.objectMerge(t[n],e[n]):t[n]=e[n]}}]),t}(),f=function t(e){n(this,t),this._win=e},h=function(t){function e(){return n(this,e),u(this,a(e).apply(this,arguments))}return o(e,f),i(e,[{key:"isSupported",value:function(){return void 0!==this._win.Notification}},{key:"create",value:function(t,e){return new this._win.Notification(t,{icon:l.isString(e.icon)||l.isUndefined(e.icon)||l.isNull(e.icon)?e.icon:e.icon.x32,body:e.body,tag:e.tag,requireInteraction:e.requireInteraction})}},{key:"close",value:function(t){t.close()}}]),e}(),d=function(e){function r(){return n(this,r),u(this,a(r).apLine truncated
/*!***************************************************
* mark.js v8.11.1
* https://markjs.io/
* Copyright (c) 2014–2018, Julian Kühnel
* Released under the MIT license https://git.io/vwTVl
*****************************************************/
!function(t,e){t.exports=function(){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},n=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},i=function(){function t(n){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;e(this,t),this.ctx=n,this.iframes=r,this.exclude=i,this.iframesTimeout=o}return n(t,[{key:"getContexts",value:function(){var t=[];return(void 0!==this.ctx&&this.ctx?NodeList.prototype.isPrototypeOf(this.ctx)?Array.prototype.slice.call(this.ctx):Array.isArray(this.ctx)?this.ctx:"string"==typeof this.ctx?Array.prototype.slice.call(document.querySelectorAll(this.ctx)):[this.ctx]:[]).forEach((function(e){var n=t.filter((function(t){return t.contains(e)})).length>0;-1!==t.indexOf(e)||n||t.push(e)})),t}},{key:"getIframeContents",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},r=void 0;try{var i=t.contentWindow;if(r=i.document,!i||!r)throw new Error("iframe inaccessible")}catch(t){n()}r&&e(r)}},{key:"isIframeBlank",value:function(t){var e="about:blank",n=t.getAttribute("src").trim();return t.contentWindow.location.href===e&&n!==e&&n}},{key:"observeIframeLoad",value:function(t,e,n){var r=this,i=!1,o=null,a=function a(){if(!i){i=!0,clearTimeout(o);try{r.isIframeBlank(t)||(t.removeEventListener("load",a),r.getIframeContents(t,e,n))}catch(t){n()}}};t.addEventListener("load",a),o=setTimeout(a,this.iframesTimeout)}},{key:"onIframeReady",value:function(t,e,n){try{"complete"===t.contentWindow.document.readyState?this.isIframeBlank(t)?this.observeIframeLoad(t,e,n):this.getIframeContents(t,e,n):this.observeIframeLoad(t,e,n)}catch(t){n()}}},{key:"waitForIframes",value:function(t,e){var n=this,r=0;this.forEachIframe(t,(function(){return!0}),(function(t){r++,n.waitForIframes(t.querySelector("html"),(function(){--r||e()}))}),(function(t){t||e()}))}},{key:"forEachIframe",value:function(e,n,r){var i=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},a=e.querySelectorAll("iframe"),s=a.length,u=0;a=Array.prototype.slice.call(a);var c=function(){--s<=0&&o(u)};s||c(),a.forEach((function(e){t.matches(e,i.exclude)?c():i.onIframeReady(e,(function(t){n(e)&&(u++,r(t)),c()}),c)}))}},{key:"createIterator",value:function(t,e,n){return document.createNodeIterator(t,e,n,!1)}},{key:"createInstanceOnIframe",value:function(e){return new t(e.querySelector("html"),this.iframes)}},{key:"compareNodeIframe",value:function(t,e,n){if(t.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECEDING){if(null===e)return!0;if(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)return!0}return!1}},{key:"getIteratorNode",value:function(t){var e=t.previousNode();return{prevNode:e,node:(null===e||t.nextNode())&&t.nextNode()}}},{key:"checkIframeFilter",value:function(t,e,n,r){var i=!1,o=!1;return r.forEach((function(t,e){t.val===n&&(i=e,o=t.handled)})),this.compareNodeIframe(t,e,n)?(!1!==i||o?!1===i||o||(r[i].handled=!0):r.push({val:n,handled:!0}),!0):(!1===i&&r.push({val:n,handled:!1}),!1)}},{key:"handleOpenIframes",value:function(t,e,n,r){var i=this;t.forEach((function(t){t.handled||i.getIframeContents(t.val,(function(t){i.createInstanceOnIframe(t).forEachNode(e,n,r)}))}))}},{key:"iterateThroughNodes",value:function(t,e,n,r,i){for(var o=this,a=this.createIterator(e,t,r),s=[],u=[],c=void 0,l=void 0,f=function(){var t=o.getIteratorNode(a);return l=t.prevNode,c=t.node};f();)this.iframes&&this.forEachIframe(e,(function(t){return o.checkIframeFilter(c,l,t,s)}),(function(e){o.createInstanceOnIframe(e).forEachNode(t,(function(t){return u.push(t)}),r)})),u.push(c);u.forEach((function(t){n(t)})),this.iframes&&this.handleOpenIframes(s,t,n,r),i()}},{key:"forEachNode",value:function(t,e,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},o=this.getContexts(),a=o.length;a||i(),o.forEach((function(o){var s=function(){r.iterateThroughNodes(t,o,e,n,(function(){--a<=0&&i()}))};r.iframes?r.waitForIframes(o,s):s()}))}}],[{key:"matches",value:function(t,e){var n="string"==typeof e?[e]:e,r=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector;if(r){var i=!1;return n.every((function(e){return!r.call(t,e)||(i=!0,!1)})),i}return!1}}]),t}(),o=function(){function o(t){e(thiLine truncated
//# sourceMappingURL=basement.bundle.min.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"basement.bundle.min.js","sources":["../node_modules/alpinejs/dist/module.esm.js","../node_modules/axios/lib/helpers/bind.js","../node_modules/axios/lib/utils.js","../node_modules/axios/lib/core/AxiosError.js","../node_modules/axios/lib/helpers/toFormData.js","../node_modules/axios/lib/helpers/AxiosURLSearchParams.js","../node_modules/axios/lib/helpers/buildURL.js","../node_modules/axios/lib/core/InterceptorManager.js","../node_modules/axios/lib/defaults/transitional.js","../node_modules/axios/lib/platform/browser/index.js","../node_modules/axios/lib/platform/browser/classes/URLSearchParams.js","../node_modules/axios/lib/platform/browser/classes/FormData.js","../node_modules/axios/lib/platform/browser/classes/Blob.js","../node_modules/axios/lib/helpers/formDataToJSON.js","../node_modules/axios/lib/defaults/index.js","../node_modules/axios/lib/helpers/toURLEncodedForm.js","../node_modules/axios/lib/helpers/parseHeaders.js","../node_modules/axios/lib/core/AxiosHeaders.js","../node_modules/axios/lib/core/transformData.js","../node_modules/axios/lib/cancel/isCancel.js","../node_modules/axios/lib/cancel/CanceledError.js","../node_modules/axios/lib/helpers/cookies.js","../node_modules/axios/lib/core/buildFullPath.js","../node_modules/axios/lib/helpers/isAbsoluteURL.js","../node_modules/axios/lib/helpers/combineURLs.js","../node_modules/axios/lib/helpers/isURLSameOrigin.js","../node_modules/axios/lib/adapters/xhr.js","../node_modules/axios/lib/helpers/speedometer.js","../node_modules/axios/lib/core/settle.js","../node_modules/axios/lib/helpers/parseProtocol.js","../node_modules/axios/lib/adapters/adapters.js","../node_modules/axios/lib/helpers/null.js","../node_modules/axios/lib/core/dispatchRequest.js","../node_modules/axios/lib/core/mergeConfig.js","../node_modules/axios/lib/env/data.js","../node_modules/axios/lib/helpers/validator.js","../node_modules/axios/lib/core/Axios.js","../node_modules/axios/lib/cancel/CancelToken.js","../node_modules/axios/lib/helpers/HttpStatusCode.js","../node_modules/axios/lib/axios.js","../node_modules/axios/lib/helpers/spread.js","../node_modules/axios/lib/helpers/isAxiosError.js","../node_modules/laravel-echo/dist/echo.js","../node_modules/pusher-js/dist/web/pusher.js","../node_modules/core-js/internals/global.js","../node_modules/core-js/internals/fails.js","../node_modules/core-js/internals/descriptors.js","../node_modules/core-js/internals/function-bind-native.js","../node_modules/core-js/internals/function-call.js","../node_modules/core-js/internals/object-property-is-enumerable.js","../node_modules/core-js/internals/create-property-descriptor.js","../node_modules/core-js/internals/engine-v8-version.js","../node_modules/core-js/internals/function-uncurry-this.js","../node_modules/core-js/internals/classof-raw.js","../node_modules/core-js/internals/indexed-object.js","../node_modules/core-js/internals/is-null-or-undefined.js","../node_modules/core-js/internals/require-object-coercible.js","../node_modules/core-js/internals/to-indexed-object.js","../node_modules/core-js/internals/document-all.js","../node_modules/core-js/internals/is-callable.js","../node_modules/core-js/internals/is-object.js","../node_modules/core-js/internals/get-built-in.js","../node_modules/core-js/internals/object-is-prototype-of.js","../node_modules/core-js/internals/engine-user-agent.js","../node_modules/core-js/internals/symbol-constructor-detection.js","../node_modules/core-js/internals/use-symbol-as-uid.js","../node_modules/core-js/internals/is-symbol.js","../node_modules/core-js/internals/try-to-string.js","../node_modules/core-js/internals/a-callable.js","../node_modules/core-js/internals/get-method.js","../node_modules/core-js/internals/ordinary-to-primitive.js","../node_modules/core-js/internals/define-global-property.js","../node_modules/core-js/internals/shared-store.js","../node_modules/core-js/internals/shared.js","../node_modules/core-js/internals/to-object.js","../node_modules/core-js/internals/has-own-property.js","../node_modules/core-js/internals/uid.js","../node_modules/core-js/internals/well-known-symbol.js","../node_modules/core-js/internals/to-primitive.js","../node_modules/core-js/internals/to-property-key.js","../node_modules/core-js/internals/document-create-element.js","../node_modules/core-js/internals/ie8-dom-define.js","../node_modules/core-js/internals/object-get-own-property-descriptor.js","../node_modules/core-js/internals/v8-prototype-define-bug.js","../node_modules/core-js/internals/an-object.js","../node_modules/core-js/internals/object-define-property.js","../node_modules/core-js/internals/create-non-enumerable-property.js","../node_modules/core-js/internals/function-name.js","../node_modules/core-js/internals/inspect-source.js","../node_modules/core-js/internals/internal-state.js","../node_modules/core-js/internals/weak-map-basic-detection.js","../node_modules/core-js/internals/shared-key.js","../node_modules/core-js/internals/hidden-keys.js","../noLine truncated
+63
View File
@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta name="robots" content="noindex">
<title>{{ __('Chat') }} — {{ config('nova.name', config('app.name')) }}</title>
<link rel="stylesheet" href="{{ asset('assets/panel/css/chat.css') }}">
</head>
<body>
<div class="mm-chat" id="mm-chat">
<header class="mm-chat__top">
<a class="mm-chat__back" href="{{ url('/panel') }}">{{ __('Back to panel') }}</a>
<h1>{{ __('Chat') }}</h1>
<span class="mm-chat__badge" id="mm-chat-unread" hidden>0</span>
</header>
<div class="mm-chat__shell">
<aside class="mm-chat__inbox">
<div class="mm-chat__inbox-head">{{ __('Conversations') }}</div>
<div class="mm-chat__list" id="mm-chat-list"></div>
<p class="mm-chat__empty" id="mm-chat-empty-inbox" hidden>{{ __('No conversations yet.') }}</p>
</aside>
<section class="mm-chat__thread">
<div class="mm-chat__thread-head" id="mm-chat-thread-head">{{ __('Select a conversation') }}</div>
<div class="mm-chat__messages" id="mm-chat-messages"></div>
<form class="mm-chat__composer" id="mm-chat-form" hidden>
<textarea
id="mm-chat-input"
rows="1"
maxlength="5000"
placeholder="{{ __('Write a message...') }}"
autocomplete="off"
></textarea>
<button type="submit" id="mm-chat-send">{{ __('Send') }}</button>
</form>
</section>
</div>
</div>
<script>
window.MM_CHAT = {
conversationsUrl: @json(url('/panel/chat/conversations')),
messagesUrl: @json(url('/panel/chat/conversations')),
csrf: @json(csrf_token()),
broadcastAuth: @json(url('/panel/broadcasting/auth')),
pusher: @json($pusher),
strings: {
select: @json(__('Select a conversation')),
noMessages: @json(__('No messages yet.')),
you: @json(__('You')),
},
};
</script>
@if (! empty($pusher['key']))
<script src="https://js.pusher.com/8.4.0/pusher.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/laravel-echo@1.16.1/dist/echo.iife.js"></script>
@endif
<script src="{{ asset('assets/panel/js/chat.js') }}"></script>
</body>
</html>
-19
View File
@@ -1,19 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test</title>
<link rel="stylesheet" href="{{ asset('vendor/basement/basement.bundle.min.css') }}">
</head>
<body>
<h1>Test</h1>
@auth
<x-basement::chat-box />
@endauth
<script src="{{ asset('vendor/basement/basement.bundle.min.js') }}"></script>
</body>
</html>
+11 -7
View File
@@ -7,6 +7,7 @@
use App\Http\Controllers\Api\V1\CartController;
use App\Http\Controllers\Api\V1\Category\CategoryController;
use App\Http\Controllers\Api\V1\Channel\ChannelController;
use App\Http\Controllers\Api\V1\Chat\ChatController;
use App\Http\Controllers\Api\V1\Collection\CollectionController;
use App\Http\Controllers\Api\V1\ContactMessageController;
use App\Http\Controllers\Api\V1\Favorite\FavoriteController;
@@ -107,18 +108,21 @@
// Global orders...
Route::post('global-order', [GlobalOrderController::class, 'store']);
// Route::middleware('auth:sanctum')->group(function () {
// Route::get('/chat/contacts', [ChatController::class, 'contacts']);
// Route::get('/chat/messages/{conversation}', [ChatController::class, 'messages']);
// Route::post('/chat/start', [ChatController::class, 'start']);
// Route::post('/chat/send', [ChatController::class, 'send']);
// });
Route::middleware(['auth:sanctum', 'banned'])->group(function () {
// Profile...
Route::get('profile', [ProfileController::class, 'index']);
Route::post('profile', [ProfileController::class, 'store']);
// Chat...
Route::get('chat/conversations', [ChatController::class, 'conversations']);
Route::get('chat/support', [ChatController::class, 'showSupport']);
Route::post('chat/support', [ChatController::class, 'support']);
Route::get('chat/contacts', [ChatController::class, 'contacts']);
Route::post('chat/start', [ChatController::class, 'start']);
Route::get('chat/conversations/{conversation}/messages', [ChatController::class, 'messages'])->where(['conversation' => '[0-9]+']);
Route::post('chat/conversations/{conversation}/messages', [ChatController::class, 'send'])->where(['conversation' => '[0-9]+']);
Route::post('chat/conversations/{conversation}/read', [ChatController::class, 'read'])->where(['conversation' => '[0-9]+']);
// Cart items...
Route::get('carts', [CartController::class, 'index']);
Route::post('carts', [CartController::class, 'store']);
+13 -1
View File
@@ -1,5 +1,6 @@
<?php
use App\Support\ChatSupport;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\Facades\DB;
@@ -15,8 +16,19 @@
*/
Broadcast::channel('chat.{conversationId}', function ($user, $conversationId) {
return DB::table('conversation_user')
$isParticipant = DB::table('conversation_user')
->where('conversation_id', $conversationId)
->where('user_id', $user->id)
->exists();
if ($isParticipant) {
return true;
}
return ChatSupport::isOperator($user)
&& ChatSupport::conversationIncludesSupport((int) $conversationId);
});
Broadcast::channel('chat.support', function ($user) {
return ChatSupport::isOperator($user);
});
+21
View File
@@ -1,7 +1,28 @@
<?php
use App\Http\Controllers\Nova\SupportChatController;
use App\Http\Controllers\OnlinePaymentController;
use App\Http\Middleware\EnsureChatOperator;
use Illuminate\Support\Facades\Route;
use Laravel\Nova\Http\Middleware\Authenticate as NovaAuthenticate;
use Laravel\Nova\Http\Middleware\Authorize as NovaAuthorize;
Route::view('/login', 'wip')->name('login');
Route::get('api/online-payment-store', [OnlinePaymentController::class, 'index'])->name('online-payment-store');
Route::middleware([NovaAuthenticate::class, NovaAuthorize::class, EnsureChatOperator::class])
->prefix('panel/chat')
->name('nova.chat.')
->group(function () {
Route::get('/', [SupportChatController::class, 'index'])->name('index');
Route::get('/conversations', [SupportChatController::class, 'conversations'])->name('conversations');
Route::get('/conversations/{conversation}/messages', [SupportChatController::class, 'messages'])
->whereNumber('conversation')
->name('messages');
Route::post('/conversations/{conversation}/messages', [SupportChatController::class, 'send'])
->whereNumber('conversation')
->name('send');
Route::post('/conversations/{conversation}/read', [SupportChatController::class, 'read'])
->whereNumber('conversation')
->name('read');
});