mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-15 11:07:53 -04:00
54 lines
2.0 KiB
PHP
54 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace Modules\Chat\Http\Controllers;
|
|
|
|
use Illuminate\Contracts\Support\Renderable;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Routing\Controller;
|
|
use Modules\Chat\Entities\Setting;
|
|
use App\Models\User;
|
|
use Modules\Chat\Repositories\BlockUserRepository;
|
|
use Modules\Chat\Repositories\UserRepository;
|
|
use Modules\Chat\Services\AugmentationService;
|
|
|
|
class ChatController extends Controller
|
|
{
|
|
public function index(Request $request)
|
|
{
|
|
$augmentation = new AugmentationService();
|
|
$augmentation->updateEnv();
|
|
|
|
$conversationId = $request->get('conversationId');
|
|
$data['conversationId'] = ! empty($conversationId) ? $conversationId : 0;
|
|
|
|
/** @var UserRepository $userRepository */
|
|
$userRepository = app(UserRepository::class);
|
|
/** @var BlockUserRepository $blockUserRepository */
|
|
$myContactIds = $userRepository->myContactIds();
|
|
|
|
/** @var BlockUserRepository $blockUserRepository */
|
|
$blockUserRepository = app(BlockUserRepository::class);
|
|
list($blockUserIds, $blockedByMeUserIds) = $blockUserRepository->blockedUserIds();
|
|
|
|
$data['users'] = User::toBase()
|
|
->limit(50)
|
|
->orderBy('name')
|
|
->select(['name', 'id'])
|
|
->pluck('name', 'id')
|
|
->except(getLoggedInUserId());
|
|
$data['enableGroupSetting'] = isGroupChatEnabled();
|
|
$data['membersCanAddGroup'] = canMemberAddGroup();
|
|
$data['myContactIds'] = $myContactIds;
|
|
$data['blockUserIds'] = $blockUserIds;
|
|
$data['blockedByMeUserIds'] = $blockedByMeUserIds;
|
|
|
|
/** @var Setting $setting */
|
|
$setting = Setting::where('key', 'notification_sound')->pluck('value', 'key')->toArray();
|
|
if (isset($setting['notification_sound'])) {
|
|
$data['notification_sound'] = app(Setting::class)->getNotificationSound($setting['notification_sound']);
|
|
}
|
|
|
|
return view('chat::index')->with($data);
|
|
}
|
|
}
|