Файловый менеджер - Редактировать - /home/c7lekhnath/silverray.com.au/Modules/Language/database/seeders/68334/LiveChat.tar
Назад
lang/.gitkeep 0000644 00000000000 15012234313 0007076 0 ustar 00 module.json 0000644 00000000342 15012234313 0006715 0 ustar 00 { "name": "LiveChat", "alias": "livechat", "description": "", "keywords": [], "priority": 0, "providers": [ "Modules\\LiveChat\\app\\Providers\\LiveChatServiceProvider" ], "files": [] } tests/Unit/.gitkeep 0000644 00000000000 15012234313 0010236 0 ustar 00 tests/Feature/.gitkeep 0000644 00000000000 15012234313 0010712 0 ustar 00 vite.config.js 0000644 00000001306 15012234313 0007307 0 ustar 00 import { defineConfig } from 'vite'; import laravel from 'laravel-vite-plugin'; export default defineConfig({ build: { outDir: '../../public/build-livechat', emptyOutDir: true, manifest: true, }, plugins: [ laravel({ publicDirectory: '../../public', buildDirectory: 'build-livechat', input: [ __dirname + '/resources/assets/sass/app.scss', __dirname + '/resources/assets/js/app.js' ], refresh: true, }), ], }); //export const paths = [ // 'Modules/$STUDLY_NAME$/resources/assets/sass/app.scss', // 'Modules/$STUDLY_NAME$/resources/assets/js/app.js', //]; wsus.json 0000644 00000000625 15012234313 0006435 0 ustar 00 { "name": "Live Chat Addon", "is_default": true, "description": "This is Live Chat Addon", "author": { "name": "Websolutionsus", "email": "websolutionus1@gmail.com", "website": "https://websolutionus.com" }, "license": "Proprietary", "url": "", "options" : { "route" : "home" }, "last_update": "2024-03-31", "version": "1.0.0" } routes/.gitkeep 0000644 00000000000 15012234313 0007476 0 ustar 00 routes/error_log 0000644 00000001104 15012234313 0007770 0 ustar 00 [07-May-2025 12:01:30 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Support\Facades\Route" not found in /home/lekhnath/silverray.com.au/Modules/LiveChat/routes/api.php:5 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/LiveChat/routes/api.php on line 5 [07-May-2025 13:32:56 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Support\Facades\Route" not found in /home/lekhnath/silverray.com.au/Modules/LiveChat/routes/web.php:7 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/LiveChat/routes/web.php on line 7 routes/web.php 0000644 00000002230 15012234313 0007342 0 ustar 00 <?php use Illuminate\Support\Facades\Route; use Modules\LiveChat\app\Http\Controllers\Admin\ChatSettingController; use Modules\LiveChat\app\Http\Controllers\LiveChatController; Route::group(['as' => 'admin.', 'prefix' => 'admin', 'middleware' => ['auth:admin', 'translation']], function () { Route::get('chat-setting', [ChatSettingController::class, 'index'])->name('chat-setting'); Route::put('update-chat-setting', [ChatSettingController::class, 'update'])->name('update-chat-setting'); }); Route::group(['middleware' => ['auth:web']], function () { Route::controller(LiveChatController::class)->group(function () { Route::get('message-list', 'index')->name('message-list'); Route::post('send-new-message', 'send_new_message')->name('send-new-message'); Route::get('load-message-box/{id}', 'load_message_box')->name('load-message-box'); Route::post('send-message', 'send_message')->name('send-message'); Route::get('load-latest-message/{id}', 'load_latest_message')->name('load-latest-message'); Route::get('get-new-contact-sender/{id}', 'get_new_contact_sender')->name('get-new-contact-sender'); }); }); routes/api.php 0000644 00000000214 15012234313 0007336 0 ustar 00 <?php use Illuminate\Support\Facades\Route; Route::middleware(['auth:sanctum'])->prefix('v1')->name('api.')->group(function () { }); composer.json 0000644 00000001303 15012234313 0007255 0 ustar 00 { "name": "nwidart/livechat", "description": "", "authors": [ { "name": "Nicolas Widart", "email": "n.widart@gmail.com" } ], "extra": { "laravel": { "providers": [], "aliases": { } } }, "autoload": { "psr-4": { "Modules\\LiveChat\\": "", "Modules\\LiveChat\\App\\": "app/", "Modules\\LiveChat\\Database\\Factories\\": "database/factories/", "Modules\\LiveChat\\Database\\Seeders\\": "database/seeders/" } }, "autoload-dev": { "psr-4": { "Modules\\LiveChat\\Tests\\": "tests/" } } } config/config.php 0000644 00000000055 15012234313 0007761 0 ustar 00 <?php return [ 'name' => 'LiveChat', ]; config/.gitkeep 0000644 00000000000 15012234313 0007422 0 ustar 00 package.json 0000644 00000000410 15012234313 0007017 0 ustar 00 { "private": true, "type": "module", "scripts": { "dev": "vite", "build": "vite build" }, "devDependencies": { "axios": "^1.1.2", "laravel-vite-plugin": "^0.7.5", "sass": "^1.69.5", "postcss": "^8.3.7", "vite": "^4.0.0" } } app/Events/LiveChatEvent.php 0000644 00000001544 15012234313 0012000 0 ustar 00 <?php namespace Modules\LiveChat\app\Events; use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; use Illuminate\Queue\SerializesModels; class LiveChatEvent implements ShouldBroadcast { use SerializesModels; public $event_message; public function __construct($event_message) { $this->event_message = $event_message; } /** * Get the channels the event should be broadcast on. */ public function broadcastOn() { return new PrivateChannel('livechat.'.$this->event_message->receiver_id); } public function broadcastWith() { return [ 'message_id' => $this->event_message->id, 'sender_id' => $this->event_message->sender_id, ]; } public function broadcastAs() { return 'live-chat'; } } app/Events/error_log 0000644 00000000276 15012234313 0010504 0 ustar 00 [14-May-2025 17:55:50 UTC] PHP Fatal error: Trait "Illuminate\Queue\SerializesModels" not found in /home/c7lekhnath/silverray.com.au/Modules/LiveChat/app/Events/LiveChatEvent.php on line 9 app/Http/Controllers/.gitkeep 0000644 00000000000 15012234313 0012162 0 ustar 00 app/Http/Controllers/error_log 0000644 00000000535 15012234313 0012463 0 ustar 00 [13-May-2025 16:33:54 UTC] PHP Fatal error: Uncaught Error: Class "App\Http\Controllers\Controller" not found in /home/lekhnath/silverray.com.au/Modules/LiveChat/app/Http/Controllers/LiveChatController.php:12 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/LiveChat/app/Http/Controllers/LiveChatController.php on line 12 app/Http/Controllers/Admin/ChatSettingController.php 0000644 00000003340 15012234313 0016565 0 ustar 00 <?php namespace Modules\LiveChat\app\Http\Controllers\Admin; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Cache; use Modules\GlobalSetting\app\Models\Setting; class ChatSettingController extends Controller { public function index() { return view('livechat::admin.chat_setting'); } public function update(Request $request) { $request->validate([ 'pusher_app_id' => 'required', 'pusher_app_key' => 'required', 'pusher_app_secret' => 'required', 'pusher_app_cluster' => 'required', 'pusher_status' => 'required', ], [ 'pusher_app_id.required' => __('App id is required'), 'pusher_app_key.required' => __('App key is required'), 'pusher_app_secret.required' => __('App secret is required'), 'pusher_app_cluster.required' => __('Cluster is required'), 'pusher_status.required' => __('Status is required'), ]); Setting::where('key', 'pusher_app_id')->update(['value' => $request->pusher_app_id]); Setting::where('key', 'pusher_app_key')->update(['value' => $request->pusher_app_key]); Setting::where('key', 'pusher_app_secret')->update(['value' => $request->pusher_app_secret]); Setting::where('key', 'pusher_app_cluster')->update(['value' => $request->pusher_app_cluster]); Setting::where('key', 'pusher_status')->update(['value' => $request->pusher_status]); Cache::forget('setting'); $notification = __('Update Successfully'); $notification = ['messege' => $notification, 'alert-type' => 'success']; return redirect()->back()->with($notification); } } app/Http/Controllers/Admin/error_log 0000644 00000000557 15012234313 0013517 0 ustar 00 [13-May-2025 20:56:52 UTC] PHP Fatal error: Uncaught Error: Class "App\Http\Controllers\Controller" not found in /home/lekhnath/silverray.com.au/Modules/LiveChat/app/Http/Controllers/Admin/ChatSettingController.php:10 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/LiveChat/app/Http/Controllers/Admin/ChatSettingController.php on line 10 app/Http/Controllers/LiveChatController.php 0000644 00000011536 15012234313 0015025 0 ustar 00 <?php namespace Modules\LiveChat\app\Http\Controllers; use App\Http\Controllers\Controller; use App\Models\User; use Auth; use Illuminate\Http\Request; use Modules\LiveChat\app\Events\LiveChatEvent; use Modules\LiveChat\app\Models\Message; class LiveChatController extends Controller { public function index() { $auth_user = Auth::guard('web')->user(); $contact_list = $auth_user->contactUsersWithUnseenMessages(); $user_list = User::where('id', '!=', $auth_user->id)->get(); return view('livechat::index')->with(['auth_user' => $auth_user, 'user_list' => $user_list, 'contact_list' => $contact_list]); } public function send_new_message(Request $request) { $request->validate([ 'receiver_id' => 'required', 'message' => 'required', ], [ 'receiver_id.required' => __('Please select a user'), 'message.required' => __('Message field is required'), ]); $auth_user = Auth::guard('web')->user(); $new_message = new Message(); $new_message->sender_id = $auth_user->id; $new_message->receiver_id = $request->receiver_id; $new_message->message = $request->message; $new_message->save(); event(new LiveChatEvent($new_message)); $notification = __('Message Sent Successfully'); $notification = ['messege' => $notification, 'alert-type' => 'success']; return redirect()->back()->with($notification); } public function load_message_box($contact_id) { $auth_user = Auth::guard('web')->user(); $contact_author = User::select('id', 'name', 'image', 'email')->findOrFail($contact_id); $message_list = Message::where(function ($query) use ($auth_user, $contact_id) { $query->where('sender_id', $auth_user->id)->where('receiver_id', $contact_id); })->orWhere(function ($query) use ($auth_user, $contact_id) { $query->where('sender_id', $contact_id)->where('receiver_id', $auth_user->id); })->get(); Message::where('receiver_id', $auth_user->id)->where('sender_id', $contact_id)->update(['seen' => 'yes']); return view('livechat::chat_body')->with([ 'contact_author' => $contact_author, 'message_list' => $message_list, 'auth_user' => $auth_user, ]); } public function send_message(Request $request) { $request->validate([ 'receiver_id' => 'required', 'message' => 'required', ], [ 'receiver_id.required' => __('Please select a user'), 'message.required' => __('Message field is required'), ]); $auth_user = Auth::guard('web')->user(); $new_message = new Message(); $new_message->sender_id = $auth_user->id; $new_message->receiver_id = $request->receiver_id; $new_message->message = $request->message; $new_message->save(); Message::where('receiver_id', $auth_user->id)->where('sender_id', $request->receiver_id)->update(['seen' => 'yes']); $auth_user = Auth::guard('web')->user(); $contact_author = User::select('id', 'name', 'image', 'email')->findOrFail($request->receiver_id); $contact_id = $request->receiver_id; $message_list = Message::where(function ($query) use ($auth_user, $contact_id) { $query->where('sender_id', $auth_user->id)->where('receiver_id', $contact_id); })->orWhere(function ($query) use ($auth_user, $contact_id) { $query->where('sender_id', $contact_id)->where('receiver_id', $auth_user->id); })->get(); event(new LiveChatEvent($new_message)); return view('livechat::chat_message')->with([ 'contact_author' => $contact_author, 'message_list' => $message_list, 'auth_user' => $auth_user, ]); } public function load_latest_message($contact_id) { $auth_user = Auth::guard('web')->user(); $contact_author = User::select('id', 'name', 'image', 'email')->findOrFail($contact_id); $message_list = Message::where(function ($query) use ($auth_user, $contact_id) { $query->where('sender_id', $auth_user->id)->where('receiver_id', $contact_id); })->orWhere(function ($query) use ($auth_user, $contact_id) { $query->where('sender_id', $contact_id)->where('receiver_id', $auth_user->id); })->get(); return view('livechat::chat_message')->with([ 'contact_author' => $contact_author, 'message_list' => $message_list, 'auth_user' => $auth_user, ]); } public function get_new_contact_sender($sender_id) { $contact_author = User::select('id', 'name', 'image', 'email')->findOrFail($sender_id); return response()->json(['contact_author' => $contact_author]); } } app/Http/Requests/.gitkeep 0000644 00000000000 15012234313 0011467 0 ustar 00 app/Http/Middleware/.gitkeep 0000644 00000000000 15012234313 0011731 0 ustar 00 app/Models/Message.php 0000644 00000001147 15012234313 0010641 0 ustar 00 <?php namespace Modules\LiveChat\app\Models; use App\Models\User; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Modules\LiveChat\Database\factories\MessageFactory; class Message extends Model { use HasFactory; /** * The attributes that are mass assignable. */ protected $fillable = []; protected static function newFactory(): MessageFactory { //return MessageFactory::new(); } public function receiver() { return $this->belongsTo(User::class, 'receiver_id')->select('id', 'name', 'image'); } } app/Models/.gitkeep 0000644 00000000000 15012234313 0010160 0 ustar 00 app/Providers/RouteServiceProvider.php 0000644 00000002667 15012234313 0014151 0 ustar 00 <?php namespace Modules\LiveChat\app\Providers; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; use Illuminate\Support\Facades\Route; class RouteServiceProvider extends ServiceProvider { /** * The module namespace to assume when generating URLs to actions. */ protected string $moduleNamespace = 'Modules\LiveChat\app\Http\Controllers'; /** * Called before routes are registered. * * Register any model bindings or pattern based filters. */ public function boot(): void { parent::boot(); } /** * Define the routes for the application. */ public function map(): void { $this->mapApiRoutes(); $this->mapWebRoutes(); } /** * Define the "web" routes for the application. * * These routes all receive session state, CSRF protection, etc. */ protected function mapWebRoutes(): void { Route::middleware('web') ->namespace($this->moduleNamespace) ->group(module_path('LiveChat', '/routes/web.php')); } /** * Define the "api" routes for the application. * * These routes are typically stateless. */ protected function mapApiRoutes(): void { Route::prefix('api') ->middleware('api') ->namespace($this->moduleNamespace) ->group(module_path('LiveChat', '/routes/api.php')); } } app/Providers/LiveChatServiceProvider.php 0000644 00000006446 15012234313 0014551 0 ustar 00 <?php namespace Modules\LiveChat\app\Providers; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; class LiveChatServiceProvider extends ServiceProvider { protected string $moduleName = 'LiveChat'; protected string $moduleNameLower = 'livechat'; /** * Boot the application events. */ public function boot(): void { $this->registerCommands(); $this->registerCommandSchedules(); $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); $this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations')); } /** * Register the service provider. */ public function register(): void { $this->app->register(RouteServiceProvider::class); } /** * Register commands in the format of Command::class */ protected function registerCommands(): void { // $this->commands([]); } /** * Register command Schedules. */ protected function registerCommandSchedules(): void { // $this->app->booted(function () { // $schedule = $this->app->make(Schedule::class); // $schedule->command('inspire')->hourly(); // }); } /** * Register translations. */ public function registerTranslations(): void { $langPath = resource_path('lang/modules/'.$this->moduleNameLower); if (is_dir($langPath)) { $this->loadTranslationsFrom($langPath, $this->moduleNameLower); $this->loadJsonTranslationsFrom($langPath); } else { $this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower); $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang')); } } /** * Register config. */ protected function registerConfig(): void { $this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config'); $this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower); } /** * Register views. */ public function registerViews(): void { $viewPath = resource_path('views/modules/'.$this->moduleNameLower); $sourcePath = module_path($this->moduleName, 'resources/views'); $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']); $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); $componentNamespace = str_replace('/', '\\', config('modules.namespace').'\\'.$this->moduleName.'\\'.config('modules.paths.generator.component-class.path')); Blade::componentNamespace($componentNamespace, $this->moduleNameLower); } /** * Get the services provided by the provider. */ public function provides(): array { return []; } private function getPublishableViewPaths(): array { $paths = []; foreach (config('view.paths') as $path) { if (is_dir($path.'/modules/'.$this->moduleNameLower)) { $paths[] = $path.'/modules/'.$this->moduleNameLower; } } return $paths; } } app/Providers/.gitkeep 0000644 00000000000 15012234313 0010712 0 ustar 00 app/Providers/error_log 0000644 00000001320 15012234313 0011204 0 ustar 00 [14-May-2025 17:13:23 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Support\ServiceProvider" not found in /home/c7lekhnath/silverray.com.au/Modules/LiveChat/app/Providers/LiveChatServiceProvider.php:8 Stack trace: #0 {main} thrown in /home/c7lekhnath/silverray.com.au/Modules/LiveChat/app/Providers/LiveChatServiceProvider.php on line 8 [14-May-2025 20:59:11 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Foundation\Support\Providers\RouteServiceProvider" not found in /home/c7lekhnath/silverray.com.au/Modules/LiveChat/app/Providers/RouteServiceProvider.php:8 Stack trace: #0 {main} thrown in /home/c7lekhnath/silverray.com.au/Modules/LiveChat/app/Providers/RouteServiceProvider.php on line 8 database/factories/.gitkeep 0000644 00000000000 15012234313 0011700 0 ustar 00 database/migrations/2023_11_22_090504_create_messages_table.php 0000644 00000001303 15012234313 0017560 0 ustar 00 <?php 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('messages', function (Blueprint $table) { $table->id(); $table->integer('sender_id'); $table->integer('receiver_id'); $table->text('message'); $table->string('seen')->default('no'); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('messages'); } }; database/migrations/.gitkeep 0000644 00000000000 15012234313 0012075 0 ustar 00 database/migrations/error_log 0000644 00000000620 15012234313 0012371 0 ustar 00 [16-May-2025 08:15:31 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Database\Migrations\Migration" not found in /home/c7lekhnath/silverray.com.au/Modules/LiveChat/database/migrations/2023_11_22_090504_create_messages_table.php:7 Stack trace: #0 {main} thrown in /home/c7lekhnath/silverray.com.au/Modules/LiveChat/database/migrations/2023_11_22_090504_create_messages_table.php on line 7 database/seeders/LiveChatDatabaseSeeder.php 0000644 00000000375 15012234313 0014726 0 ustar 00 <?php namespace Modules\LiveChat\database\seeders; use Illuminate\Database\Seeder; class LiveChatDatabaseSeeder extends Seeder { /** * Run the database seeds. */ public function run(): void { // $this->call([]); } } database/seeders/.gitkeep 0000644 00000000000 15012234313 0011353 0 ustar 00 database/seeders/error_log 0000644 00000000532 15012234313 0011651 0 ustar 00 [16-May-2025 11:49:18 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Database\Seeder" not found in /home/c7lekhnath/silverray.com.au/Modules/LiveChat/database/seeders/LiveChatDatabaseSeeder.php:7 Stack trace: #0 {main} thrown in /home/c7lekhnath/silverray.com.au/Modules/LiveChat/database/seeders/LiveChatDatabaseSeeder.php on line 7 resources/assets/.gitkeep 0000644 00000000000 15012234313 0011471 0 ustar 00 resources/assets/js/app.js 0000644 00000000000 15012234313 0011572 0 ustar 00 resources/assets/sass/app.scss 0000644 00000000000 15012234313 0012466 0 ustar 00 resources/views/chat_body.blade.php 0000644 00000004772 15012234313 0013432 0 ustar 00 <div class="card-header"> <h4>Chat with {{ $contact_author->name }}</h4> </div> <div class="card-body chat-content"> @foreach ($message_list as $index => $message_item) @if ($message_item->sender_id == $auth_user->id) <div class="chat-item chat-right"> <img src="https://www.gravatar.com/avatar/75d23af433e0cea4c0e45a56dba18b30"> <div class="chat-details"> <div class="chat-text">{{ html_decode($message_item->message) }}</div> <div class="chat-time">{{ $message_item->created_at->format('d F, Y, H:i A') }}</div> </div> </div> @else <div class="chat-item chat-left"> <img src="https://www.gravatar.com/avatar/75d23af433e0cea4c0e45a56dba18b30"> <div class="chat-details"> <div class="chat-text">{{ html_decode($message_item->message) }}</div> <div class="chat-time">{{ $message_item->created_at->format('d F, Y, H:i A') }}</div> </div> </div> @endif @endforeach </div> <div class="card-footer chat-form"> <form id="chat_form"> @csrf <input type="text" class="form-control contact_message" placeholder="Type a message" name="message" autocomplete="off"> <input type="hidden" name="receiver_id" value="{{ $contact_author->id }}"> <button type="submit" class="btn btn-primary"> <i class="far fa-paper-plane"></i> </button> </form> </div> <script> "use strict"; (function($) { $("#chat_form").on("submit", function(event){ event.preventDefault() if($('.contact_message').val()){ $.ajax({ type : 'post', data : $(this).serialize(), url : "{{ route('send-message') }}", success : function(response){ $('.contact_message').val(''); $(".chat-content").html(response); scrollToBottomFunc(); }, error : function(error){ alert("server error") } }) } }) })(jQuery); </script> resources/views/admin/chat_setting.blade.php 0000644 00000013456 15012234313 0015241 0 ustar 00 @extends('admin.master_layout') @section('title') <title>{{ __('Pusher Configuration') }}</title> @endsection @section('admin-content') <!-- Main Content --> <div class="main-content"> <section class="section"> <x-admin.breadcrumb title="{{ __('Pusher Configuration') }}" :list="[ __('Dashboard') => route('admin.dashboard'), __('Pusher Configuration') => '#', ]" /> <div class="section-body"> <div class="row"> <div class="col-12"> <div class="card"> <div class="card-body"> <form action="{{ route('admin.update-chat-setting') }}" method="POST"> @csrf @method('PUT') <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="name">{{ __('App Id') }}</label> @if (env('APP_MODE') == 'DEMO') <input type="text" name="pusher_app_id" value="pusher-test.93943-app-key" class="form-control"> @else <input type="text" name="pusher_app_id" value="{{ $setting->pusher_app_id }}" class="form-control"> @endif </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="name">{{ __('App Key') }}</label> @if (env('APP_MODE') == 'DEMO') <input type="text" name="pusher_app_key" value="test.pusher-933-key" class="form-control"> @else <input type="text" name="pusher_app_key" value="{{ $setting->pusher_app_key }}" class="form-control"> @endif </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="email">{{ __('App Secret') }}</label> @if (env('APP_MODE') == 'DEMO') <input type="text" name="pusher_app_secret" value="test-app-393-secret" class="form-control"> @else <input type="text" name="pusher_app_secret" value="{{ $setting->pusher_app_secret }}" class="form-control"> @endif </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="name">{{ __('App Cluster') }}</label> @if (env('APP_MODE') == 'DEMO') <input type="text" name="pusher_app_cluster" value="123" class="form-control"> @else <input type="text" name="pusher_app_cluster" value="{{ $setting->pusher_app_cluster }}" class="form-control"> @endif </div> </div> <div class="col-md-12"> <div class="form-group"> <label for="pusher_status">{{ __('Status') }}</label> <select name="pusher_status" id="pusher_status" class="form-control"> <option {{ $setting->pusher_status == 'active' ? 'selected' : '' }} value="active">{{ __('Enable') }}</option> <option {{ $setting->pusher_status == 'inactive' ? 'selected' : '' }} value="inactive">{{ __('Disable') }}</option> </select> </div> </div> </div> <button type="submit" class="btn btn-success">{{ __('Update') }}</button> </form> </div> </div> </div> </div> </div> </section> </div> @endsection resources/views/chat_message.blade.php 0000644 00000001752 15012234313 0014114 0 ustar 00 @foreach ($message_list as $index => $message_item) @if ($message_item->sender_id == $auth_user->id) <div class="chat-item chat-right"> <img src="https://www.gravatar.com/avatar/75d23af433e0cea4c0e45a56dba18b30"> <div class="chat-details"> <div class="chat-text">{{ html_decode($message_item->message) }}</div> <div class="chat-time">{{ $message_item->created_at->format('d F, Y, H:i A') }}</div> </div> </div> @else <div class="chat-item chat-left"> <img src="https://www.gravatar.com/avatar/75d23af433e0cea4c0e45a56dba18b30"> <div class="chat-details"> <div class="chat-text">{{ html_decode($message_item->message) }}</div> <div class="chat-time">{{ $message_item->created_at->format('d F, Y, H:i A') }}</div> </div> </div> @endif @endforeach resources/views/.gitkeep 0000644 00000000000 15012234313 0011324 0 ustar 00 resources/views/error_log 0000644 00000000252 15012234313 0011621 0 ustar 00 [08-May-2025 13:02:44 UTC] PHP Warning: Undefined variable $contact_list in /home/lekhnath/silverray.com.au/Modules/LiveChat/resources/views/index.blade.php on line 172 resources/views/index.blade.php 0000644 00000031043 15012234313 0012574 0 ustar 00 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no" name="viewport"> <title>Messages</title> <meta name="csrf-token" content="{{ csrf_token() }}"> <link rel="stylesheet" href="{{ asset('backend/css/bootstrap.min.css') }}"> <link rel="stylesheet" href="{{ asset('backend/fontawesome/css/all.min.css') }}"> <link rel="stylesheet" href="{{ asset('backend/css/style.css') }}"> <link rel="stylesheet" href="{{ asset('backend/css/bootstrap-social.css') }}"> <link rel="stylesheet" href="{{ asset('backend/css/components.css') }}"> <link rel="stylesheet" href="{{ asset('global/toastr/toastr.min.css') }}"> <link rel="stylesheet" href="{{ asset('backend/css/bootstrap4-toggle.min.css') }}"> <link rel="stylesheet" href="{{ asset('backend/css/dev.css') }}"> <link rel="stylesheet" href="{{ asset('backend/css/select2.min.css') }}"> <link rel="stylesheet" href="{{ asset('backend/css/tagify.css') }}"> <link rel="stylesheet" href="{{ asset('backend/css/bootstrap-tagsinput.css') }}"> <link rel="stylesheet" href="{{ asset('backend/css/fontawesome-iconpicker.min.css') }}"> <link rel="stylesheet" href="{{ asset('backend/css/bootstrap-datepicker.min.css') }}"> <link rel="stylesheet" href="{{ asset('backend/clockpicker/dist/bootstrap-clockpicker.css') }}"> <link rel="stylesheet" href="{{ asset('backend/datetimepicker/jquery.datetimepicker.css') }}"> <link rel="stylesheet" href="{{ asset('backend/css/iziToast.min.css') }}"> <script src="{{ asset('global/js/jquery-3.7.1.min.js') }}"></script> <script> var PUSHER_APP_KEY = "{{ $setting->pusher_app_key }}"; var PUSHER_APP_CLUSTER = "{{ $setting->pusher_app_cluster }}"; var ROOT_ROUTE = "{{ route('home') }}"; var PUSHER_AUTH_ROUTE = ROOT_ROUTE + "/broadcasting/auth"; </script> @vite(['resources/js/app.js']) <!-- /END GA --> </head> <body> <div> <!-- Main Content --> <div class="main-content"> <section class="section"> <div class="section-header"> <h1>Chat Box : I am {{ $auth_user->name }}</h1> </div> <div class="section-body"> <form action="{{ route('send-new-message') }}" method="POST"> @csrf <div class="form-group"> <select name="receiver_id" id="" class="form-control"> <option value="">Select User</option> @foreach ($user_list as $list_item) <option value="{{ $list_item->id }}">{{ $list_item->name }}</option> @endforeach </select> </div> <div class="form-group"> <input type="text" name="message" class="form-control"> </div> <button class="btn btn-primary">Send Message</button> </form> </div> <br> <br> <br> <br> <br> <br> <br> <div class="section-body"> <div class="row"> <div class="col-md-4"> <div class="card"> <div class="card-body"> <ul class="list-unstyled list-unstyled-border" id="contact_list"> @foreach ($contact_list as $contact_item) <li class="media" onclick="loadChatBody('{{ $contact_item->id }}')"> <img alt="image" class="me-3 rounded-circle" width="50" src="https://www.gravatar.com/avatar/75d23af433e0cea4c0e45a56dba18b30"> <div class="media-body"> <div class="mt-0 mb-1 font-weight-bold">{{ $contact_item?->name }} - <b class="new_message_count_{{ $contact_item->id }} {{ $contact_item?->new_message == 0 ? 'd-none' : '' }}">{{ $contact_item?->new_message }}</b></div> <div class="text-small font-weight-600 text-muted active_status_{{ $contact_item->id }}"><i class="fas fa-circle"></i> Offline </div> </div> </li> @endforeach </ul> </div> </div> </div> <div class="col-md-8"> <input type="hidden" id="active_contact_id"> <div class="card chat-box" id="mychatbox"> </div> </div> </div> </div> </section> </div> <footer class="main-footer"> <div class="footer-left"> Copyright © 2018 <div class="bullet"></div> Design By <a href="https://nauval.in/">Muhamad Nauval Azhar</a> </div> <div class="footer-right"> </div> </footer> </div> </div> <script src="{{ asset('backend/js/popper.min.js') }}"></script> <script src="{{ asset('backend/js/bootstrap.min.js') }}"></script> <script src="{{ asset('global/toastr/toastr.min.js') }}"></script> <script> @if (Session::has('messege')) var type = "{{ Session::get('alert-type', 'info') }}" switch (type) { case 'info': toastr.info("{{ Session::get('messege') }}"); break; case 'success': toastr.success("{{ Session::get('messege') }}"); break; case 'warning': toastr.warning("{{ Session::get('messege') }}"); break; case 'error': toastr.error("{{ Session::get('messege') }}"); break; } @endif </script> @if ($errors->any()) @foreach ($errors->all() as $error) <script> toastr.error('{{ $error }}'); </script> @endforeach @endif <script type="module"> let auth_user_id = "{{ $auth_user->id }}"; let contact_list = <?php echo json_encode($contact_list); ?>; Echo.channel(`private-livechat.${auth_user_id}`) .listen('.live-chat', (res) => { toastr.success('You have received new message'); /*at first need to check the sender id is already available in contact list or not, if not need to push the contact item in list*/ let is_exist = contact_list.find(list_item => list_item.id == res.sender_id); if(is_exist){ let active_contact_id = $("#active_contact_id").val() /*if selected user and new message sender id is same, request to latest message list and append on message body */ if(active_contact_id == res.sender_id){ $.ajax({ type : 'get', url : "{{ url('/load-latest-message') }}" + "/" + active_contact_id, success : function(response){ $(".chat-content").html(response); scrollToBottomFunc(); }, error : function(error){ alert("server error") } }) }else{ let new_message_count = $(".new_message_count_"+res.sender_id).html(); new_message_count = parseInt(new_message_count) + parseInt(1); $(".new_message_count_"+res.sender_id).html(new_message_count) $(".new_message_count_"+res.sender_id).removeClass('d-none') } }else{ /*get new sender info and push to existing list*/ $.ajax({ type : 'get', url : "{{ url('/get-new-contact-sender') }}" + "/" + res.sender_id, success : function(response){ let contact_author = response.contact_author contact_list.push({ id : contact_author.id, name : contact_author.name, email : contact_author.email, last_message : 'last_message', image : contact_author.image, new_message : 'new_message', }); let new_list_item = `<li class="media" onclick="loadChatBody('${contact_author.id}')"> <img alt="image" class="me-3 rounded-circle" width="50" src="https://www.gravatar.com/avatar/75d23af433e0cea4c0e45a56dba18b30"> <div class="media-body"> <div class="mt-0 mb-1 font-weight-bold">${contact_author.name} - <b class="new_message_count_${contact_author.id}">1</b></div> <div class="text-success text-small font-600-bold"><i class="fas fa-circle"></i> Online </div> {{-- <div class="text-small font-weight-600 text-muted"><i class="fas fa-circle"></i> Offline</div> --}} </div> </li>` $("#contact_list").prepend(new_list_item); }, error : function(error){ alert("server error") } }) } }); Echo.join(`trackactiveuser`) .here((users) => { let user_id_sets = new Set(users.map(user => user.id)); contact_list.forEach(function(contact_item) { let is_user_exist = user_id_sets.has(contact_item.id); if(is_user_exist){ $(".active_status_"+ contact_item.id).addClass("font-600-bold text-success") $(".active_status_"+ contact_item.id).removeClass("font-weight-600 text-muted") $(".active_status_"+ contact_item.id).html(`<i class="fas fa-circle"></i> Online`) } }); }) .joining((user) => { contact_list.forEach(function(contact_item) { if(contact_item.id == user.id){ $(".active_status_"+ contact_item.id).addClass("font-600-bold text-success") $(".active_status_"+ contact_item.id).removeClass("font-weight-600 text-muted") $(".active_status_"+ contact_item.id).html(`<i class="fas fa-circle"></i> Online`) } }); }) .leaving((user) => { contact_list.forEach(function(contact_item) { if(contact_item.id == user.id){ $(".active_status_"+ contact_item.id).removeClass("font-600-bold text-success") $(".active_status_"+ contact_item.id).addClass("font-weight-600 text-muted") $(".active_status_"+ contact_item.id).html(`<i class="fas fa-circle"></i> Offline`) } }); }) .error((error) => { console.error(error); }); </script> <script> (function($) { "use strict"; })(jQuery); function loadChatBody(contact_id){ $(".new_message_count_"+contact_id).html(0) $(".new_message_count_"+contact_id).addClass('d-none') $.ajax({ type : 'get', url : "{{ url('/load-message-box') }}" + "/" + contact_id, success : function(response){ $("#mychatbox").html(response); scrollToBottomFunc(); $("#active_contact_id").val(contact_id) }, error : function(error){ alert("server error") } }) } function scrollToBottomFunc() { $('.chat-content').animate({ scrollTop: $('.chat-content').get(0).scrollHeight }, 50); } </script> @stack('js') </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.3.20 | Генерация страницы: 0.01 |
proxy
|
phpinfo
|
Настройка