├── resources ├── css │ └── app.css ├── js │ ├── app.js │ └── bootstrap.js └── views │ ├── admin │ ├── members_ajax.blade.php │ ├── activities.blade.php │ ├── notifications.blade.php │ ├── master.blade.php │ └── conversations.blade.php │ ├── user │ ├── members_ajax.blade.php │ ├── activities.blade.php │ ├── notifications.blade.php │ ├── dashboard.blade.php │ ├── master.blade.php │ └── conversations.blade.php │ ├── signon.blade.php │ └── login.blade.php ├── database ├── .gitignore ├── seeders │ ├── DatabaseSeeder.php │ └── StatusSeeder.php ├── migrations │ ├── 2023_05_04_150324_alter_users_table.php │ ├── 2023_03_23_171508_create_departments_table.php │ ├── 2023_03_26_164703_create_settings_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2023_03_26_115543_create_status_table.php │ ├── 2023_03_24_153954_create_activities_table.php │ ├── 2023_04_29_140927_create_files_table.php │ ├── 2023_03_24_153147_create_notifications_table.php │ ├── 2023_03_27_153734_create_conversations_table.php │ ├── 2023_03_27_153854_create_messages_table.php │ ├── 2023_05_03_153739_alter_status_table.php │ ├── 2023_05_03_153445_alter_activities_table.php │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ ├── 2023_05_03_151537_alter_notifications_table.php │ ├── 2023_05_03_163529_alter_files_table.php │ ├── 2023_05_03_153925_alter_conversations_table.php │ ├── 2023_03_27_154202_create_participants_table.php │ ├── 2019_12_14_000001_create_personal_access_tokens_table.php │ ├── 2023_05_03_154158_alter_messages_table.php │ ├── 2014_10_12_000000_create_users_table.php │ └── 2023_05_03_154539_alter_participants_table.php └── factories │ └── UserFactory.php ├── bootstrap ├── cache │ └── .gitignore ├── Settings.php ├── Activity.php ├── SetStatus.php ├── Notification.php └── app.php ├── storage ├── logs │ └── .gitignore ├── app │ ├── public │ │ └── .gitignore │ └── .gitignore ├── debugbar │ └── .gitignore └── framework │ ├── testing │ └── .gitignore │ ├── views │ └── .gitignore │ ├── cache │ ├── data │ │ └── .gitignore │ └── .gitignore │ ├── sessions │ └── .gitignore │ └── .gitignore ├── public ├── robots.txt ├── favicon.ico ├── assets │ └── loading.gif ├── fonts │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ └── fontawesome-webfont.woff2 ├── css │ ├── login.css │ ├── notification.css │ ├── dash.css │ ├── normalize.min.css │ ├── activity.css │ └── msg.css ├── .htaccess ├── js │ ├── jquery.cookie.min.js │ └── members.js ├── index.php └── logo │ └── KChat.svg ├── tests ├── TestCase.php ├── Unit │ └── ExampleTest.php ├── Feature │ └── ExampleTest.php └── CreatesApplication.php ├── .gitattributes ├── SECURITY.md ├── vite.config.js ├── .editorconfig ├── .gitignore ├── app ├── Models │ ├── Status.php │ ├── Departments.php │ ├── Activity.php │ ├── Notifications.php │ └── User.php ├── Http │ ├── Middleware │ │ ├── EncryptCookies.php │ │ ├── VerifyCsrfToken.php │ │ ├── PreventRequestsDuringMaintenance.php │ │ ├── TrustHosts.php │ │ ├── TrimStrings.php │ │ ├── Authenticate.php │ │ ├── ValidateSignature.php │ │ ├── GetChats.php │ │ ├── GoIn.php │ │ ├── TrustProxies.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── CheckLogin.php │ │ └── GetCounts.php │ ├── Controllers │ │ ├── Controller.php │ │ ├── ActivityController.php │ │ ├── NotificationController.php │ │ ├── AuthController.php │ │ ├── MessageController.php │ │ ├── SettingController.php │ │ └── ConversationsController.php │ └── Kernel.php ├── Providers │ ├── BroadcastServiceProvider.php │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php ├── Console │ └── Kernel.php └── Exceptions │ └── Handler.php ├── package.json ├── lang ├── en │ ├── pagination.php │ ├── auth.php │ ├── passwords.php │ ├── login.php │ └── lang.php └── hi │ ├── login.php │ └── lang.php ├── routes ├── channels.php ├── api.php ├── console.php └── web.php ├── config ├── cors.php ├── services.php ├── view.php ├── hashing.php ├── broadcasting.php ├── sanctum.php ├── filesystems.php ├── queue.php ├── cache.php ├── mail.php ├── auth.php ├── logging.php └── database.php ├── phpunit.xml ├── .env.example ├── artisan ├── README.md └── composer.json /resources/css/app.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite* 2 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | import './bootstrap'; 2 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/debugbar/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/php-kchat/kchat/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/assets/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/php-kchat/kchat/HEAD/public/assets/loading.gif -------------------------------------------------------------------------------- /public/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/php-kchat/kchat/HEAD/public/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /public/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/php-kchat/kchat/HEAD/public/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /public/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/php-kchat/kchat/HEAD/public/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /public/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/php-kchat/kchat/HEAD/public/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /public/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/php-kchat/kchat/HEAD/public/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /public/css/login.css: -------------------------------------------------------------------------------- 1 | .divider:after, 2 | .divider:before { 3 | content: ""; 4 | flex: 1; 5 | height: 1px; 6 | background: #eee; 7 | } -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | compiled.php 2 | config.php 3 | down 4 | events.scanned.php 5 | maintenance.php 6 | routes.php 7 | routes.scanned.php 8 | schedule-* 9 | services.json 10 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "vite", 5 | "build": "vite build" 6 | }, 7 | "devDependencies": { 8 | "axios": "^1.6.0", 9 | "laravel-vite-plugin": "^0.7.2", 10 | "lodash": "^4.17.19", 11 | "postcss": "^8.4.31", 12 | "vite": "^4.0.0" 13 | }, 14 | "dependencies": { 15 | "normalize.css": "^8.0.1" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | protected $fillable = [ 18 | 'department' 19 | ]; 20 | } 21 | -------------------------------------------------------------------------------- /database/seeders/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(StatusSeeder::class); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Http/Middleware/PreventRequestsDuringMaintenance.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustHosts.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | public function hosts() 15 | { 16 | return [ 17 | $this->allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 'current_password', 16 | 'password', 17 | 'password_confirmation', 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /app/Models/Activity.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | protected $fillable = [ 18 | 'uid', 19 | 'title', 20 | 'notification', 21 | ]; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | protected $fillable = [ 18 | 'uid', 19 | 'title', 20 | 'photo', 21 | 'notification', 22 | ]; 23 | } 24 | -------------------------------------------------------------------------------- /bootstrap/Settings.php: -------------------------------------------------------------------------------- 1 | where('key',$key)->get(); 9 | } 10 | 11 | static function set($key, $value){ 12 | 13 | $data = [ 14 | 'key' => $key, 15 | 'value' => $value, 16 | ]; 17 | 18 | DB::table('settings')->updateOrInsert( 19 | ['key' => $key], // Check if a record exists with the email 20 | $data, // If record doesn't exist, insert this data 21 | ); 22 | 23 | } 24 | } -------------------------------------------------------------------------------- /bootstrap/Activity.php: -------------------------------------------------------------------------------- 1 | Auth()->user()->id, 17 | 'title' => $title, 18 | 'notification' => $notification, 19 | 'created_at' => now(), 20 | 'updated_at' => now(), 21 | ]); 22 | } 23 | } -------------------------------------------------------------------------------- /bootstrap/SetStatus.php: -------------------------------------------------------------------------------- 1 | where('uid',Auth()->user()->id) 19 | ->where('status',$status) 20 | ->update([ 21 | 'seen' => $last, 22 | 'updated_at' => now(), 23 | ]); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | return route('login'); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/ValidateSignature.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 'fbclid', 16 | // 'utm_campaign', 17 | // 'utm_content', 18 | // 'utm_medium', 19 | // 'utm_source', 20 | // 'utm_term', 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /app/Http/Middleware/GetChats.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 18 | return $request->user(); 19 | }); 20 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->purpose('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Send Requests To Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /database/migrations/2023_05_04_150324_alter_users_table.php: -------------------------------------------------------------------------------- 1 | bigInteger('role')->unsigned()->change(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | // 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /app/Http/Middleware/GoIn.php: -------------------------------------------------------------------------------- 1 | insert([ 20 | [ 21 | 'status' => 'message', 22 | 'seen' => 0, 23 | 'uid' => Auth()->user()->id, 24 | ], 25 | [ 26 | 'status' => 'notification', 27 | 'seen' => 0, 28 | 'uid' => Auth()->user()->id, 29 | ] 30 | ]); 31 | */ 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'password' => 'The provided password is incorrect.', 18 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 19 | 20 | ]; 21 | -------------------------------------------------------------------------------- /bootstrap/Notification.php: -------------------------------------------------------------------------------- 1 | whereIn('id',$uid)->get()->toArray(); 22 | 23 | foreach ($users as &$user) { 24 | $user['title'] = $title; 25 | $user['notification'] = $notification; 26 | $user['photo'] = Auth()->user()->photo; 27 | $user['created_at'] = now(); 28 | $user['updated_at'] = now(); 29 | } 30 | 31 | Notifications::insert($users); 32 | } 33 | } -------------------------------------------------------------------------------- /app/Providers/AuthServiceProvider.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | protected $policies = [ 16 | // 'App\Models\Model' => 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any authentication / authorization services. 21 | * 22 | * @return void 23 | */ 24 | public function boot() 25 | { 26 | $this->registerPolicies(); 27 | 28 | // 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /database/migrations/2023_03_23_171508_create_departments_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('department')->unique(); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::dropIfExists('departments'); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | |string|null 14 | */ 15 | protected $proxies; 16 | 17 | /** 18 | * The headers that should be used to detect proxies. 19 | * 20 | * @var int 21 | */ 22 | protected $headers = 23 | Request::HEADER_X_FORWARDED_FOR | 24 | Request::HEADER_X_FORWARDED_HOST | 25 | Request::HEADER_X_FORWARDED_PORT | 26 | Request::HEADER_X_FORWARDED_PROTO | 27 | Request::HEADER_X_FORWARDED_AWS_ELB; 28 | } 29 | -------------------------------------------------------------------------------- /database/migrations/2023_03_26_164703_create_settings_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('key'); 19 | $table->string('value'); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('settings'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire')->hourly(); 19 | } 20 | 21 | /** 22 | * Register the commands for the application. 23 | * 24 | * @return void 25 | */ 26 | protected function commands() 27 | { 28 | $this->load(__DIR__.'/Commands'); 29 | 30 | require base_path('routes/console.php'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Your password has been reset!', 17 | 'sent' => 'We have emailed your password reset link!', 18 | 'throttled' => 'Please wait before retrying.', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that email address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->primary(); 18 | $table->string('token'); 19 | $table->timestamp('created_at')->nullable(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('password_resets'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2023_03_26_115543_create_status_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('status'); 19 | $table->integer('uid')->unsigned(); 20 | $table->integer('seen')->unsigned(); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('status'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /database/migrations/2023_03_24_153954_create_activities_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->integer('uid')->unsigned(); 19 | $table->string('title'); 20 | $table->text('notification'); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('activities'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /database/migrations/2023_04_29_140927_create_files_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->integer('conversation_id')->unsigned(); 19 | $table->string('Name'); 20 | $table->string('uuid'); 21 | $table->string('MimeType'); 22 | $table->index('uuid'); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('files'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /public/css/dash.css: -------------------------------------------------------------------------------- 1 | .order-card { 2 | color: #fff; 3 | } 4 | 5 | .bg-c-blue { 6 | background: linear-gradient(45deg,#4099ff,#73b4ff); 7 | } 8 | 9 | .bg-c-green { 10 | background: linear-gradient(45deg,#2ed8b6,#59e0c5); 11 | } 12 | 13 | .bg-c-yellow { 14 | background: linear-gradient(45deg,#FFB64D,#ffcb80); 15 | } 16 | 17 | .bg-c-pink { 18 | background: linear-gradient(45deg,#FF5370,#ff869a); 19 | } 20 | 21 | 22 | .card { 23 | border-radius: 5px; 24 | -webkit-box-shadow: 0 1px 2.94px 0.06px rgba(4,26,55,0.16); 25 | box-shadow: 0 1px 2.94px 0.06px rgba(4,26,55,0.16); 26 | border: none; 27 | margin-bottom: 30px; 28 | -webkit-transition: all 0.3s ease-in-out; 29 | transition: all 0.3s ease-in-out; 30 | } 31 | 32 | .card .card-block { 33 | padding: 25px; 34 | } 35 | 36 | .order-card i { 37 | font-size: 26px; 38 | } 39 | 40 | .f-left { 41 | float: left; 42 | } 43 | 44 | .f-right { 45 | float: right; 46 | } -------------------------------------------------------------------------------- /database/migrations/2023_03_24_153147_create_notifications_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->integer('uid')->unsigned(); 19 | $table->string('photo')->nullable(); 20 | $table->string('title'); 21 | $table->text('notification'); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('notifications'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /database/migrations/2023_03_27_153734_create_conversations_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->integer('message_id')->unsigned(); 19 | $table->string('conversation_name')->default('Untitled'); 20 | $table->string('photo')->default('/logo/KChat_Logo.svg'); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('conversations'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /database/migrations/2023_03_27_153854_create_messages_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->integer('user_id')->unsigned(); 19 | $table->integer('conversation_id')->unsigned(); 20 | $table->text('message'); 21 | $table->integer('type')->unsigned()->default(0); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('messages'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /database/migrations/2023_05_03_153739_alter_status_table.php: -------------------------------------------------------------------------------- 1 | bigInteger('uid')->unsigned()->change(); 18 | $table->foreign('uid')->references('id')->on('users')->onDelete('cascade'); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::table('status', function(Blueprint $table){ 30 | $table->dropForeign('status_uid_foreign'); 31 | $table->dropIndex('status_uid_foreign'); 32 | }); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /config/cors.php: -------------------------------------------------------------------------------- 1 | ['api/*', 'sanctum/csrf-cookie'], 19 | 20 | 'allowed_methods' => ['*'], 21 | 22 | 'allowed_origins' => ['*'], 23 | 24 | 'allowed_origins_patterns' => [], 25 | 26 | 'allowed_headers' => ['*'], 27 | 28 | 'exposed_headers' => [], 29 | 30 | 'max_age' => 0, 31 | 32 | 'supports_credentials' => false, 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /database/migrations/2023_05_03_153445_alter_activities_table.php: -------------------------------------------------------------------------------- 1 | bigInteger('uid')->unsigned()->change(); 18 | $table->foreign('uid')->references('id')->on('users')->onDelete('cascade'); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::table('activities', function(Blueprint $table){ 30 | $table->dropForeign('activities_uid_foreign'); 31 | $table->dropIndex('activities_uid_foreign'); 32 | }); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /database/migrations/2019_08_19_000000_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('uuid')->unique(); 19 | $table->text('connection'); 20 | $table->text('queue'); 21 | $table->longText('payload'); 22 | $table->longText('exception'); 23 | $table->timestamp('failed_at')->useCurrent(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('failed_jobs'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2023_05_03_151537_alter_notifications_table.php: -------------------------------------------------------------------------------- 1 | bigInteger('uid')->unsigned()->change(); 18 | $table->foreign('uid')->references('id')->on('users')->onDelete('cascade'); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::table('notifications', function(Blueprint $table){ 30 | $table->dropForeign('notifications_uid_foreign'); 31 | $table->dropIndex('notifications_uid_foreign'); 32 | }); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /database/migrations/2023_05_03_163529_alter_files_table.php: -------------------------------------------------------------------------------- 1 | bigInteger('conversation_id')->unsigned()->change(); 18 | $table->foreign('conversation_id')->references('id')->on('conversations')->onDelete('cascade'); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::table('files', function(Blueprint $table){ 30 | $table->dropForeign('files_conversation_id_foreign'); 31 | $table->dropIndex('files_conversation_id_foreign'); 32 | }); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 26 | return redirect(RouteServiceProvider::HOME); 27 | } 28 | } 29 | 30 | return $next($request); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Middleware/CheckLogin.php: -------------------------------------------------------------------------------- 1 | user()->role]; 28 | 29 | //Sharing variable with view 30 | view()->share('role', $role); 31 | 32 | //Setting Attribute to use in Controller 33 | $request->role = $role; 34 | 35 | return $next($request); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /database/migrations/2023_05_03_153925_alter_conversations_table.php: -------------------------------------------------------------------------------- 1 | bigInteger('message_id')->unsigned()->change(); 18 | // $table->foreign('message_id')->references('id')->on('messages')->onDelete('cascade'); 19 | //}); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | //Schema::table('conversations', function(Blueprint $table){ 30 | // $table->dropForeign('conversations_message_id_foreign'); 31 | // $table->dropIndex('conversations_message_id_foreign'); 32 | //}); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /database/migrations/2023_03_27_154202_create_participants_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->integer('user_id')->unsigned(); 19 | $table->integer('conversation_id')->unsigned(); 20 | $table->string('status')->nullable(); 21 | $table->timestamps(); 22 | $table->integer('seen')->unsigned()->default(0); 23 | //$table->unique(['user_id','conversation_id'], 'user_id_conversation_id_unique_key'); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('participants'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->morphs('tokenable'); 19 | $table->string('name'); 20 | $table->string('token', 64)->unique(); 21 | $table->text('abilities')->nullable(); 22 | $table->timestamp('last_used_at')->nullable(); 23 | $table->timestamp('expires_at')->nullable(); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::dropIfExists('personal_access_tokens'); 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | 'scheme' => 'https', 22 | ], 23 | 24 | 'postmark' => [ 25 | 'token' => env('POSTMARK_TOKEN'), 26 | ], 27 | 28 | 'ses' => [ 29 | 'key' => env('AWS_ACCESS_KEY_ID'), 30 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 31 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 32 | ], 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | > 16 | */ 17 | protected $listen = [ 18 | Registered::class => [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | * 26 | * @return void 27 | */ 28 | public function boot() 29 | { 30 | // 31 | } 32 | 33 | /** 34 | * Determine if events and listeners should be automatically discovered. 35 | * 36 | * @return bool 37 | */ 38 | public function shouldDiscoverEvents() 39 | { 40 | return false; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class UserFactory extends Factory 12 | { 13 | /** 14 | * Define the model's default state. 15 | * 16 | * @return array 17 | */ 18 | public function definition() 19 | { 20 | return [ 21 | 'name' => fake()->name(), 22 | 'email' => fake()->unique()->safeEmail(), 23 | 'email_verified_at' => now(), 24 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 25 | 'remember_token' => Str::random(10), 26 | ]; 27 | } 28 | 29 | /** 30 | * Indicate that the model's email address should be unverified. 31 | * 32 | * @return static 33 | */ 34 | public function unverified() 35 | { 36 | return $this->state(fn (array $attributes) => [ 37 | 'email_verified_at' => null, 38 | ]); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/Http/Controllers/ActivityController.php: -------------------------------------------------------------------------------- 1 | orderBy('id', 'desc')->where('uid',Auth()->user()->id)->paginate(10); 13 | 14 | $pages = range(1, $infos->lastPage()); 15 | 16 | if($request->role == 'admin'){ 17 | return view('admin.activities',compact('infos','pages')); 18 | } 19 | 20 | return view('user.activities',compact('infos','pages')); 21 | } 22 | 23 | function delete(Request $request){ 24 | 25 | if(isset($request->id)){ 26 | $request->ids = [$request->id]; 27 | } 28 | 29 | if(count($request->ids) == 0){ 30 | return json_encode(['error' => 'No activity is selected']); 31 | } 32 | 33 | DB::table('activities') 34 | ->whereIn('id',$request->ids) 35 | ->where('uid',Auth()->user()->id) 36 | ->delete(); 37 | 38 | return json_encode([]); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('views'), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => env( 32 | 'VIEW_COMPILED_PATH', 33 | realpath(storage_path('framework/views')) 34 | ), 35 | 36 | ]; 37 | -------------------------------------------------------------------------------- /app/Models/User.php: -------------------------------------------------------------------------------- 1 | 19 | */ 20 | protected $fillable = [ 21 | 'first_name', 22 | 'last_name', 23 | 'email', 24 | 'password', 25 | 'phone', 26 | 'status', 27 | 'department', 28 | 'about', 29 | 'photo', 30 | ]; 31 | 32 | /** 33 | * The attributes that should be hidden for serialization. 34 | * 35 | * @var array 36 | */ 37 | protected $hidden = [ 38 | 'password', 39 | 'remember_token', 40 | ]; 41 | 42 | /** 43 | * The attributes that should be cast. 44 | * 45 | * @var array 46 | */ 47 | protected $casts = [ 48 | 'email_verified_at' => 'datetime', 49 | ]; 50 | } 51 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | , \Psr\Log\LogLevel::*> 14 | */ 15 | protected $levels = [ 16 | // 17 | ]; 18 | 19 | /** 20 | * A list of the exception types that are not reported. 21 | * 22 | * @var array> 23 | */ 24 | protected $dontReport = [ 25 | // 26 | ]; 27 | 28 | /** 29 | * A list of the inputs that are never flashed to the session on validation exceptions. 30 | * 31 | * @var array 32 | */ 33 | protected $dontFlash = [ 34 | 'current_password', 35 | 'password', 36 | 'password_confirmation', 37 | ]; 38 | 39 | /** 40 | * Register the exception handling callbacks for the application. 41 | * 42 | * @return void 43 | */ 44 | public function register() 45 | { 46 | $this->reportable(function (Throwable $e) { 47 | // 48 | }); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /public/js/jquery.cookie.min.js: -------------------------------------------------------------------------------- 1 | /*! jquery.cookie v1.4.1 | MIT */ 2 | !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?a(require("jquery")):a(jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}}); -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | ./tests/Unit 10 | 11 | 12 | ./tests/Feature 13 | 14 | 15 | 16 | 17 | ./app 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | LOG_DEPRECATIONS_CHANNEL=null 9 | LOG_LEVEL=debug 10 | 11 | DB_CONNECTION=mysql 12 | DB_HOST=127.0.0.1 13 | DB_PORT=3306 14 | DB_DATABASE=laravel 15 | DB_USERNAME=root 16 | DB_PASSWORD= 17 | 18 | BROADCAST_DRIVER=log 19 | CACHE_DRIVER=file 20 | FILESYSTEM_DISK=local 21 | QUEUE_CONNECTION=sync 22 | SESSION_DRIVER=file 23 | SESSION_LIFETIME=120 24 | 25 | MEMCACHED_HOST=127.0.0.1 26 | 27 | REDIS_HOST=127.0.0.1 28 | REDIS_PASSWORD=null 29 | REDIS_PORT=6379 30 | 31 | MAIL_MAILER=smtp 32 | MAIL_HOST=mailpit 33 | MAIL_PORT=1025 34 | MAIL_USERNAME=null 35 | MAIL_PASSWORD=null 36 | MAIL_ENCRYPTION=null 37 | MAIL_FROM_ADDRESS="hello@example.com" 38 | MAIL_FROM_NAME="${APP_NAME}" 39 | 40 | AWS_ACCESS_KEY_ID= 41 | AWS_SECRET_ACCESS_KEY= 42 | AWS_DEFAULT_REGION=us-east-1 43 | AWS_BUCKET= 44 | AWS_USE_PATH_STYLE_ENDPOINT=false 45 | 46 | PUSHER_APP_ID= 47 | PUSHER_APP_KEY= 48 | PUSHER_APP_SECRET= 49 | PUSHER_HOST= 50 | PUSHER_PORT=443 51 | PUSHER_SCHEME=https 52 | PUSHER_APP_CLUSTER=mt1 53 | 54 | VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 55 | VITE_PUSHER_HOST="${PUSHER_HOST}" 56 | VITE_PUSHER_PORT="${PUSHER_PORT}" 57 | VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" 58 | VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 59 | -------------------------------------------------------------------------------- /database/migrations/2023_05_03_154158_alter_messages_table.php: -------------------------------------------------------------------------------- 1 | bigInteger('user_id')->unsigned()->change(); 18 | $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); 19 | $table->bigInteger('conversation_id')->unsigned()->change(); 20 | $table->foreign('conversation_id')->references('id')->on('conversations')->onDelete('cascade'); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::table('messages', function(Blueprint $table){ 32 | $table->dropForeign('messages_user_id_foreign'); 33 | $table->dropIndex('messages_user_id_foreign'); 34 | $table->dropForeign('messages_conversation_id_foreign'); 35 | $table->dropIndex('messages_conversation_id_foreign'); 36 | }); 37 | } 38 | }; 39 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('first_name'); 19 | $table->string('last_name'); 20 | $table->string('email')->unique(); 21 | $table->string('password'); 22 | $table->timestamp('email_verified_at')->nullable(); 23 | $table->string('phone')->nullable(); 24 | $table->string('status')->default('Active'); 25 | $table->string('department')->nullable(); 26 | $table->string('about')->nullable(); 27 | $table->string('photo')->nullable()->default('/logo/KChat.svg'); 28 | $table->enum('role', [0,1,2])->default(1); 29 | $table->rememberToken(); 30 | $table->timestamps(); 31 | }); 32 | } 33 | 34 | /** 35 | * Reverse the migrations. 36 | * 37 | * @return void 38 | */ 39 | public function down() 40 | { 41 | Schema::dropIfExists('users'); 42 | } 43 | }; 44 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | import _ from 'lodash'; 2 | window._ = _; 3 | 4 | /** 5 | * We'll load the axios HTTP library which allows us to easily issue requests 6 | * to our Laravel back-end. This library automatically handles sending the 7 | * CSRF token as a header based on the value of the "XSRF" token cookie. 8 | */ 9 | 10 | import axios from 'axios'; 11 | window.axios = axios; 12 | 13 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 14 | 15 | /** 16 | * Echo exposes an expressive API for subscribing to channels and listening 17 | * for events that are broadcast by Laravel. Echo and event broadcasting 18 | * allows your team to easily build robust real-time web applications. 19 | */ 20 | 21 | // import Echo from 'laravel-echo'; 22 | 23 | // import Pusher from 'pusher-js'; 24 | // window.Pusher = Pusher; 25 | 26 | // window.Echo = new Echo({ 27 | // broadcaster: 'pusher', 28 | // key: import.meta.env.VITE_PUSHER_APP_KEY, 29 | // cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1', 30 | // wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, 31 | // wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, 32 | // wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, 33 | // forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', 34 | // enabledTransports: ['ws', 'wss'], 35 | // }); 36 | -------------------------------------------------------------------------------- /database/migrations/2023_05_03_154539_alter_participants_table.php: -------------------------------------------------------------------------------- 1 | bigInteger('user_id')->unsigned()->change(); 18 | $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); 19 | $table->bigInteger('conversation_id')->unsigned()->change(); 20 | $table->foreign('conversation_id')->references('id')->on('conversations')->onDelete('cascade'); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::table('participants', function(Blueprint $table){ 32 | $table->dropForeign('participants_conversation_id_foreign'); 33 | $table->dropIndex('participants_conversation_id_foreign'); 34 | $table->dropForeign('participants_user_id_foreign'); 35 | $table->dropIndex('participants_user_id_foreign'); 36 | //$table->dropUnique('user_id_conversation_id_unique_key'); 37 | }); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /app/Http/Controllers/NotificationController.php: -------------------------------------------------------------------------------- 1 | orderBy('id', 'desc')->where('uid',Auth()->user()->id)->paginate(10); 14 | 15 | $pages = range(1, $infos->lastPage()); 16 | 17 | $last = $infos->items(); 18 | 19 | if(isset($last[0])){ 20 | 21 | $last = $last[0]->id; 22 | 23 | $status = $request->get('status'); 24 | 25 | if($status['notification']){ 26 | 27 | SetStatus::save()->last('notification',$last); 28 | 29 | } 30 | } 31 | 32 | if($request->role == 'admin'){ 33 | return view('admin.notifications',compact('infos','pages')); 34 | } 35 | 36 | return view('user.notifications',compact('infos','pages')); 37 | } 38 | 39 | function delete(Request $request){ 40 | 41 | if(isset($request->id)){ 42 | $request->ids = [$request->id]; 43 | } 44 | 45 | if(count($request->ids) == 0){ 46 | return json_encode(['error' => 'No notification is selected']); 47 | } 48 | 49 | DB::table('notifications') 50 | ->whereIn('id',$request->ids) 51 | ->where('uid',Auth()->user()->id) 52 | ->delete(); 53 | 54 | return json_encode([]); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | configureRateLimiting(); 30 | 31 | $this->routes(function () { 32 | Route::middleware('api') 33 | ->prefix('api') 34 | ->group(base_path('routes/api.php')); 35 | 36 | Route::middleware('web') 37 | ->group(base_path('routes/web.php')); 38 | }); 39 | } 40 | 41 | /** 42 | * Configure the rate limiters for the application. 43 | * 44 | * @return void 45 | */ 46 | protected function configureRateLimiting() 47 | { 48 | RateLimiter::for('api', function (Request $request) { 49 | return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); 50 | }); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lang/en/login.php: -------------------------------------------------------------------------------- 1 | 'Sign in', 17 | 'lang00001' => 'Sign in using form below', 18 | 'lang00002' => 'Email', 19 | 'lang00003' => 'Password', 20 | 'lang00004' => 'Remember me', 21 | 'lang00005' => 'Sign On', 22 | 'lang00006' => 'Login', 23 | 'lang00007' => 'No account', 24 | 'lang00008' => 'Registration takes less than a minute but gives you full control over your orders.', 25 | 'lang00009' => 'First Name', 26 | 'lang00010' => 'Please enter first name', 27 | 'lang00011' => 'E-mail Address', 28 | 'lang00012' => 'Phone Number', 29 | 'lang00013' => 'Password', 30 | 'lang00014' => 'Confirm Password', 31 | 'lang00015' => 'Already have account', 32 | 'lang00016' => 'Last Name', 33 | 'lang00017' => 'Please enter last Name', 34 | 'lang00018' => 'Please enter valid email address!', 35 | 'lang00019' => 'Please enter your phone number!', 36 | 'lang00020' => 'Please enter password!', 37 | 'lang00021' => 'Passwords do not match!', 38 | 'lang00022' => 'Already have account', 39 | 40 | ]; 41 | -------------------------------------------------------------------------------- /lang/hi/login.php: -------------------------------------------------------------------------------- 1 | 'साइन इन करें', 17 | 'lang00001' => 'नीचे दिए गए फ़ॉर्म का उपयोग करके साइन इन करें', 18 | 'lang00002' => 'ईमेल', 19 | 'lang00003' => 'पासवर्ड', 20 | 'lang00004' => 'मुझे याद रखें', 21 | 'lang00005' => 'साइन ऑन करें', 22 | 'lang00006' => 'लॉग इन करें', 23 | 'lang00007' => 'कोई अकाउंट नहीं है', 24 | 'lang00008' => 'रजिस्ट्रेशन करने में एक मिनट से भी कम समय लगता है लेकिन इससे आपको अपने ऑर्डरों पर पूर्ण नियंत्रण मिलता है।', 25 | 'lang00009' => 'पहला नाम', 26 | 'lang00010' => 'कृपया पहला नाम दर्ज करें', 27 | 'lang00011' => 'ईमेल पता', 28 | 'lang00012' => 'फ़ोन नंबर', 29 | 'lang00013' => 'पासवर्ड', 30 | 'lang00014' => 'पासवर्ड की पुष्टि कीजिए', 31 | 'lang00015' => 'पहले से ही अकाउंट है', 32 | 'lang00016' => 'अंतिम नाम', 33 | 'lang00017' => 'कृपया अंतिम नाम दर्ज करें', 34 | 'lang00018' => 'कृपया वैध ईमेल पता दर्ज करें!', 35 | 'lang00019' => 'कृपया अपना फ़ोन नंबर दर्ज करें!', 36 | 'lang00020' => 'कृपया पासवर्ड दर्ज करें!', 37 | 'lang00021' => 'पासवर्ड मेल नहीं खाते!', 38 | 'lang00022' => 'पहले से ही अकाउंट है', 39 | 40 | ]; 41 | -------------------------------------------------------------------------------- /app/Http/Middleware/GetCounts.php: -------------------------------------------------------------------------------- 1 | forget('chat_id'); 24 | session()->forget('message_id'); 25 | session()->forget('previous'); 26 | 27 | $status = Status::select(['status','seen'])->where('uid', Auth()->user()->id)->get()->toArray(); 28 | 29 | if(count($status) == 0){ 30 | 31 | $status = [ 32 | [ 33 | 'status' => 'message', 34 | 'seen' => 0, 35 | 'uid' => Auth()->user()->id, 36 | ], 37 | [ 38 | 'status' => 'notification', 39 | 'seen' => 0, 40 | 'uid' => Auth()->user()->id, 41 | ] 42 | ]; 43 | 44 | DB::table('status')->insert($status); 45 | 46 | } 47 | 48 | $status = array_combine(array_column($status,'status'),array_column($status,'seen')); 49 | 50 | $status['notification'] = Notifications::where('id', '>', $status['notification'])->where('uid', Auth()->user()->id)->count(); 51 | 52 | //Sharing variable with view 53 | view()->share('status', $status); 54 | 55 | //Setting Attribute to use in Controller 56 | $request->attributes->set('status', $status); 57 | 58 | return $next($request); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 10), 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Argon Options 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the configuration options that should be used when 41 | | passwords are hashed using the Argon algorithm. These will allow you 42 | | to control the amount of time it takes to hash the given password. 43 | | 44 | */ 45 | 46 | 'argon' => [ 47 | 'memory' => 65536, 48 | 'threads' => 1, 49 | 'time' => 4, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /public/css/normalize.min.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none} 2 | /*# sourceMappingURL=normalize.min.css.map */ -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /resources/views/admin/members_ajax.blade.php: -------------------------------------------------------------------------------- 1 | @foreach($users as $user) 2 | 3 | [Photo] 4 | {{ $user->first_name }} {{ $user->last_name }} 5 | {{ $user->department }} 6 | {{ $user->email }} 7 | {{ $user->status }} 8 | 9 | @endforeach 10 | -------------------------------------------------------------------------------- /resources/views/user/members_ajax.blade.php: -------------------------------------------------------------------------------- 1 | @foreach($users as $user) 2 | 3 | [Photo] 4 | {{ $user->first_name }} {{ $user->last_name }} 5 | {{ $user->department }} 6 | {{ $user->email }} 7 | {{ $user->status }} 8 | 9 | @endforeach 10 | -------------------------------------------------------------------------------- /public/css/activity.css: -------------------------------------------------------------------------------- 1 | .profile-information .profile-pic img { 2 | width: 160px; 3 | height: 160px; 4 | border-radius: 50%; 5 | -webkit-border-radius: 50%; 6 | border: 10px solid #f1f2f7; 7 | margin-top: 20px; 8 | } 9 | 10 | .profile-information .profile-desk h1 { 11 | color: #1fb5ad; 12 | font-size: 24px; 13 | font-weight: bold; 14 | margin-bottom: 0; 15 | } 16 | 17 | .panel { 18 | margin-bottom: 20px; 19 | background-color: #fff; 20 | border: 1px solid transparent; 21 | border-radius: 4px; 22 | -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05); 23 | box-shadow: 0 1px 1px rgba(0,0,0,.05); 24 | } 25 | 26 | .profile-information .profile-desk { 27 | border-right: 1px solid #ddd; 28 | padding-right: 30px; 29 | } 30 | 31 | .act-content{ 32 | padding:40px; 33 | } 34 | 35 | .recent-act h1 { 36 | text-align: center; 37 | color: #1fb5ad; 38 | font-size: 16px; 39 | font-weight: bold; 40 | text-transform: uppercase; 41 | } 42 | 43 | .activity-icon { 44 | border-radius: 50%; 45 | -webkit-border-radius: 50%; 46 | color: #FFFFFF; 47 | height: 30px; 48 | line-height: 30px; 49 | text-align: center; 50 | width: 30px; 51 | margin: 20px auto 20px; 52 | position: relative; 53 | } 54 | 55 | .activity-icon.terques { 56 | background: #8fd6d6; 57 | } 58 | 59 | .activity-icon { 60 | background: #C7CBD6; 61 | } 62 | 63 | .recent-act:before { 64 | background-color: #eeeeee; 65 | bottom: 0; 66 | content: ""; 67 | left: 50%; 68 | position: absolute; 69 | top: 50px; 70 | width: 2px; 71 | z-index: 0; 72 | } 73 | 74 | .activity-desk { 75 | padding: 15px 30px; 76 | background: #f2f2f2; 77 | border-radius: 5px; 78 | -webkit-border-radius: 5px; 79 | position: relative; 80 | text-align: center; 81 | } 82 | 83 | .activity-desk h2 { 84 | color: #1fb5ad; 85 | font-size: 14px; 86 | font-weight: bold; 87 | margin: 0 0 10px 0; 88 | text-transform: uppercase; 89 | } 90 | 91 | 92 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ![](https://github.com/php-kchat/kchat/blob/master/public/logo/3.svg) 3 | 4 | # KChat 5 | #### PHP Based Chat Application. 6 | 7 | ## Requirements 8 | 9 | * Web Server Apache or Nginx 10 | * MySQL 5.7 11 | * PHP version >= 8.0 12 | * Required extensions : 13 | * ctype 14 | * curl 15 | * dom 16 | * fileinfo 17 | * filter 18 | * hash 19 | * json 20 | * libxml 21 | * mbstring 22 | * openssl 23 | * pcre 24 | * phar 25 | * session 26 | * tokenizer 27 | * xml 28 | * xmlwriter 29 | 30 | ## Manual installation 31 | 32 | #### Downlaod Kchat Files 33 | 34 | #### Using git 35 | 36 | ``` 37 | git clone https://github.com/php-kchat/kchat.git 38 | ``` 39 | 40 | #### Install Composer 41 | 42 | ``` 43 | composer install 44 | ``` 45 | 46 | > OR 47 | 48 | [Download Zip](https://github.com/php-kchat/kchat/archive/refs/heads/master.zip) 49 | and Extract to your Web Directory 50 | 51 | #### Install Composer 52 | 53 | ``` 54 | composer install 55 | ``` 56 | 57 | > OR 58 | 59 | #### Using with Composer 60 | 61 | ``` 62 | composer create-project php-kchat/kchat 63 | ``` 64 | 65 | ### Run following command to complete installation 66 | 67 | Create ``.env`` if not exist. 68 | ``` 69 | cp .env.example .env 70 | ``` 71 | 72 | Configure database details in ``.env`` 73 | ``` 74 | DB_CONNECTION=mysql 75 | DB_HOST=127.0.0.1 76 | DB_PORT=3306 77 | DB_DATABASE=laravel 78 | DB_USERNAME=root 79 | DB_PASSWORD= 80 | ``` 81 | 82 | Generate ``APP_KEY`` in the ``.env`` file: 83 | ``` 84 | php artisan key:generate 85 | ``` 86 | 87 | Create tables: 88 | ``` 89 | php artisan migrate 90 | ``` 91 | 92 | Give a Writable Permission on 93 | 94 | - storage/* 95 | - bootstrap/cache/* 96 | - public/images/* 97 | 98 | Sign-in your first user and login 99 | 100 | #### Maintainers 101 | 102 | - [Ganesh Kandu](https://github.com/GaneshKandu) 103 | - [Linkedin](https://www.linkedin.com/in/ganeshkandu/) 104 | -------------------------------------------------------------------------------- /app/Http/Controllers/AuthController.php: -------------------------------------------------------------------------------- 1 | validate([ 18 | 'first_name' => 'required', 19 | 'last_name' => 'required', 20 | 'email' => 'required|email|unique:users', 21 | 'password' => 'required|min:6', 22 | ]); 23 | 24 | $data = $request->all(); 25 | 26 | $id = DB::table('users')->insertGetId([ 27 | 'first_name' => $data['first_name'], 28 | 'last_name' => $data['last_name'], 29 | 'email' => $data['email'], 30 | 'phone' => $data['phone'], 31 | 'password' => Hash::make($data['password']), 32 | 'created_at' => now(), 33 | 'updated_at' => now(), 34 | ]); 35 | 36 | if($id == 1){ 37 | DB::table('users') 38 | ->where('id',$id) 39 | ->limit(1) 40 | ->update(['role' => '0']); 41 | } 42 | 43 | return redirect('login'); 44 | } 45 | 46 | function login(Request $request) 47 | { 48 | $request->validate([ 49 | 'email' => 'required', 50 | 'password' => 'required' 51 | ]); 52 | 53 | $credentials = $request->only('email', 'password'); 54 | 55 | if(Auth::attempt($credentials)){ 56 | ActivityLog::log()->save('Login','You have successfully logged in.'); 57 | } 58 | 59 | return json_encode([]); 60 | } 61 | 62 | function logout(Request $request) 63 | { 64 | ActivityLog::log()->save('Logout','You have successfully logged out.'); 65 | 66 | Session::flush(); 67 | 68 | Auth::logout(); 69 | 70 | return json_encode([]); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class); 55 | 56 | $response = $kernel->handle( 57 | $request = Request::capture() 58 | )->send(); 59 | 60 | $kernel->terminate($request, $response); 61 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "The Laravel Framework.", 5 | "keywords": ["framework", "laravel"], 6 | "license": "MIT", 7 | "require": { 8 | "php": "^8.0.2", 9 | "doctrine/dbal": "^3.6", 10 | "guzzlehttp/guzzle": "^7.2", 11 | "laravel/framework": "^9.19", 12 | "laravel/sanctum": "^3.0", 13 | "laravel/tinker": "^2.7" 14 | }, 15 | "require-dev": { 16 | "barryvdh/laravel-debugbar": "^3.8", 17 | "fakerphp/faker": "^1.9.1", 18 | "laravel/pint": "^1.0", 19 | "laravel/sail": "^1.0.1", 20 | "mockery/mockery": "^1.4.4", 21 | "nunomaduro/collision": "^6.1", 22 | "phpunit/phpunit": "^9.5.10", 23 | "spatie/laravel-ignition": "^1.0" 24 | }, 25 | "autoload": { 26 | "psr-4": { 27 | "App\\": "app/", 28 | "Database\\Factories\\": "database/factories/", 29 | "Database\\Seeders\\": "database/seeders/" 30 | } 31 | }, 32 | "autoload-dev": { 33 | "psr-4": { 34 | "Tests\\": "tests/" 35 | } 36 | }, 37 | "scripts": { 38 | "post-autoload-dump": [ 39 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 40 | "@php artisan package:discover --ansi" 41 | ], 42 | "post-update-cmd": [ 43 | "@php artisan vendor:publish --tag=laravel-assets --ansi --force" 44 | ], 45 | "post-root-package-install": [ 46 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 47 | ], 48 | "post-create-project-cmd": [ 49 | "@php artisan key:generate --ansi" 50 | ] 51 | }, 52 | "extra": { 53 | "laravel": { 54 | "dont-discover": [] 55 | } 56 | }, 57 | "config": { 58 | "optimize-autoloader": true, 59 | "preferred-install": "dist", 60 | "sort-packages": true, 61 | "allow-plugins": { 62 | "pestphp/pest-plugin": true 63 | } 64 | }, 65 | "minimum-stability": "stable", 66 | "prefer-stable": true 67 | } 68 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 40 | 'port' => env('PUSHER_PORT', 443), 41 | 'scheme' => env('PUSHER_SCHEME', 'https'), 42 | 'encrypted' => true, 43 | 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', 44 | ], 45 | 'client_options' => [ 46 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html 47 | ], 48 | ], 49 | 50 | 'ably' => [ 51 | 'driver' => 'ably', 52 | 'key' => env('ABLY_KEY'), 53 | ], 54 | 55 | 'redis' => [ 56 | 'driver' => 'redis', 57 | 'connection' => 'default', 58 | ], 59 | 60 | 'log' => [ 61 | 'driver' => 'log', 62 | ], 63 | 64 | 'null' => [ 65 | 'driver' => 'null', 66 | ], 67 | 68 | ], 69 | 70 | ]; 71 | -------------------------------------------------------------------------------- /app/Http/Controllers/MessageController.php: -------------------------------------------------------------------------------- 1 | chat; 13 | 14 | $conversation[0] = false; 15 | 16 | if(empty($chat)){ 17 | 18 | $chat = ''; 19 | 20 | }else{ 21 | 22 | // Checking if user is part of conversation 23 | $tmp = DB::table('participants')->where(['conversation_id' => $chat,'user_id' => Auth()->user()->id])->get()->toArray(); 24 | 25 | if(count($tmp)){ 26 | 27 | $conversation = DB::table('conversations') 28 | ->where('id',$chat) 29 | ->get(); 30 | 31 | } 32 | } 33 | 34 | $conversation = $conversation[0]; 35 | 36 | if($request->role == 'admin'){ 37 | return view('common.msg',compact('chat','conversation')); 38 | } 39 | 40 | return view('common.msg',compact('chat','conversation')); 41 | } 42 | 43 | function UpdateConversation(Request $request){ 44 | 45 | if($request->grpname == null){ 46 | return json_encode(['error' => 'Group name is empty']); 47 | } 48 | 49 | // checking if user is participant of conversation also fetching conversation_id 50 | $tmp = DB::table('participants')->where(['conversation_id' => $request->group_id,'user_id' => Auth()->user()->id])->get()->toArray(); 51 | 52 | if(count($tmp)){ 53 | 54 | $data = []; 55 | 56 | $file = $request->file('photo'); 57 | 58 | if(!empty($file)){ 59 | $image_path = $file->getClientOriginalName(); 60 | $path = '/images/' . $image_path; 61 | $file->move(public_path('/images'), $image_path); 62 | $data['photo'] = $path; 63 | } 64 | 65 | $data['updated_at'] = now(); 66 | 67 | if(!empty($request->grpname)){ 68 | $data['conversation_name'] = $request->grpname; 69 | } 70 | 71 | DB::table('conversations') 72 | ->where('id',$request->group_id) 73 | ->limit(1) 74 | ->update($data); 75 | 76 | } 77 | 78 | return json_encode([]); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /config/sanctum.php: -------------------------------------------------------------------------------- 1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( 19 | '%s%s', 20 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', 21 | Sanctum::currentApplicationUrlWithPort() 22 | ))), 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Sanctum Guards 27 | |-------------------------------------------------------------------------- 28 | | 29 | | This array contains the authentication guards that will be checked when 30 | | Sanctum is trying to authenticate a request. If none of these guards 31 | | are able to authenticate the request, Sanctum will use the bearer 32 | | token that's present on an incoming request for authentication. 33 | | 34 | */ 35 | 36 | 'guard' => ['web'], 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Expiration Minutes 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This value controls the number of minutes until an issued token will be 44 | | considered expired. If this value is null, personal access tokens do 45 | | not expire. This won't tweak the lifetime of first-party sessions. 46 | | 47 | */ 48 | 49 | 'expiration' => null, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Sanctum Middleware 54 | |-------------------------------------------------------------------------- 55 | | 56 | | When authenticating your first-party SPA with Sanctum you may need to 57 | | customize some of the middleware Sanctum uses while processing the 58 | | request. You may change the middleware listed below as required. 59 | | 60 | */ 61 | 62 | 'middleware' => [ 63 | 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 64 | 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, 65 | ], 66 | 67 | ]; 68 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DISK', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Filesystem Disks 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure as many filesystem "disks" as you wish, and you 24 | | may even configure multiple disks of the same driver. Defaults have 25 | | been set up for each driver as an example of the required values. 26 | | 27 | | Supported Drivers: "local", "ftp", "sftp", "s3" 28 | | 29 | */ 30 | 31 | 'disks' => [ 32 | 33 | 'local' => [ 34 | 'driver' => 'local', 35 | 'root' => storage_path('app'), 36 | 'throw' => false, 37 | ], 38 | 39 | 'public' => [ 40 | 'driver' => 'local', 41 | 'root' => storage_path('app/public'), 42 | 'url' => env('APP_URL').'/storage', 43 | 'visibility' => 'public', 44 | 'throw' => false, 45 | ], 46 | 47 | 's3' => [ 48 | 'driver' => 's3', 49 | 'key' => env('AWS_ACCESS_KEY_ID'), 50 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 51 | 'region' => env('AWS_DEFAULT_REGION'), 52 | 'bucket' => env('AWS_BUCKET'), 53 | 'url' => env('AWS_URL'), 54 | 'endpoint' => env('AWS_ENDPOINT'), 55 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 56 | 'throw' => false, 57 | ], 58 | 59 | ], 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Symbolic Links 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Here you may configure the symbolic links that will be created when the 67 | | `storage:link` Artisan command is executed. The array keys should be 68 | | the locations of the links and the values should be their targets. 69 | | 70 | */ 71 | 72 | 'links' => [ 73 | public_path('storage') => storage_path('app/public'), 74 | ], 75 | 76 | ]; 77 | -------------------------------------------------------------------------------- /app/Http/Controllers/SettingController.php: -------------------------------------------------------------------------------- 1 | role != 'admin'){ 15 | return false; 16 | } 17 | 18 | $TimeZone = \DateTimeZone::listIdentifiers(); 19 | 20 | $departments = DB::table('departments')->get(); 21 | 22 | $settings = DB::table('settings')->get()->toArray(); 23 | 24 | $tmp = [ 25 | 'uploadpath' => '', 26 | 'Timezone' => 'Asia/Kolkata', 27 | ]; 28 | 29 | foreach($settings as $setting){ 30 | $tmp[$setting->key] = $setting->value; 31 | } 32 | 33 | $settings = $tmp; 34 | 35 | return view('admin.settings',compact('departments','TimeZone','settings')); 36 | } 37 | 38 | function TimeZone(Request $request){ 39 | 40 | if($request->role != 'admin'){ 41 | return false; 42 | } 43 | 44 | \Settings::set('Timezone',$request->timezone); 45 | ActivityLog::log()->save('Timezone','You have successfully updated Timezone to '.$request->timezone); 46 | } 47 | 48 | function AddDepartment(Request $request){ 49 | 50 | if($request->role != 'admin'){ 51 | return false; 52 | } 53 | 54 | if($request->adddepartment == null){ 55 | return json_encode(array('error' => 'Department field is empty')); 56 | } 57 | 58 | DB::table('departments')->insert( 59 | ['department' => $request->adddepartment] 60 | ); 61 | 62 | ActivityLog::log()->save('Setting','You have successfully Added '.$request->adddepartment.' Department.'); 63 | 64 | return json_encode([]); 65 | } 66 | 67 | function DeleteDepartment(Request $request){ 68 | 69 | if($request->role != 'admin'){ 70 | return false; 71 | } 72 | 73 | DB::table('departments')->where('department', $request->deletedepartment)->delete(); 74 | 75 | ActivityLog::log()->save('Setting','You have successfully Deleted '.$request->deletedepartment.' Department.'); 76 | } 77 | 78 | function uploadpath(Request $request){ 79 | 80 | if($request->role != 'admin'){ 81 | return false; 82 | } 83 | 84 | if($request->uploadpath == null){ 85 | return json_encode(array('error' => 'Upload path field is empty')); 86 | } 87 | 88 | \Settings::set('uploadpath',$request->uploadpath); 89 | 90 | ActivityLog::log()->save('Setting','You have set upload path to '.$request->uploadpath.'.'); 91 | 92 | return json_encode([]); 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | protected $middleware = [ 17 | // \App\Http\Middleware\TrustHosts::class, 18 | \App\Http\Middleware\TrustProxies::class, 19 | \Illuminate\Http\Middleware\HandleCors::class, 20 | \App\Http\Middleware\PreventRequestsDuringMaintenance::class, 21 | \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, 22 | \App\Http\Middleware\TrimStrings::class, 23 | \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, 24 | ]; 25 | 26 | /** 27 | * The application's route middleware groups. 28 | * 29 | * @var array> 30 | */ 31 | protected $middlewareGroups = [ 32 | 'web' => [ 33 | \App\Http\Middleware\EncryptCookies::class, 34 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 35 | \Illuminate\Session\Middleware\StartSession::class, 36 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 37 | \App\Http\Middleware\VerifyCsrfToken::class, 38 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 39 | ], 40 | 41 | 'api' => [ 42 | // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 43 | 'throttle:api', 44 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 45 | ], 46 | 47 | 'CheckLogin' => [ 48 | Middleware\CheckLogin::class, 49 | ], 50 | 51 | 'GoIn' => [ 52 | Middleware\GoIn::class, 53 | ], 54 | 55 | 'GetCounts' => [ 56 | Middleware\GetCounts::class, 57 | ], 58 | 59 | ]; 60 | 61 | /** 62 | * The application's route middleware. 63 | * 64 | * These middleware may be assigned to groups or used individually. 65 | * 66 | * @var array 67 | */ 68 | protected $routeMiddleware = [ 69 | 'auth' => \App\Http\Middleware\Authenticate::class, 70 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 71 | 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 72 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 73 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 74 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 75 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 76 | 'signed' => \App\Http\Middleware\ValidateSignature::class, 77 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 78 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 79 | ]; 80 | } 81 | -------------------------------------------------------------------------------- /lang/en/lang.php: -------------------------------------------------------------------------------- 1 | 'All your total Message', 17 | 'all-your-total-conversations' => 'All your total Conversations', 18 | 'this-month' => 'This Month', 19 | 'total-users' => 'Total User\'s', 20 | 'total-messages' => 'Total Message\'s', 21 | 'total-conversations' => 'Total conversation\'s', 22 | 'average-messages-per-user' => 'Average message\'s per user', 23 | 'all-messages-per-day' => 'All message\'s per day', 24 | 'all-users-per-day' => 'All user\'s per day', 25 | 'all-conversations-per-day' => 'All conversation\'s per day', 26 | 'all-your-messages-per-day' => 'All your message\'s per day', 27 | 'all-your-conversations-per-day' => 'All your conversation\'s per day', 28 | 'dashboard' => 'Dashboard', 29 | 'messages' => 'Messages', 30 | 'members' => 'Member\'s', 31 | 'conversations' => 'Conversations', 32 | 'settings' => 'Settings', 33 | 'notification' => 'Notification', 34 | 'activity' => 'Activity', 35 | 'profile' => 'Profile', 36 | 'logout' => 'Logout', 37 | 'close' => 'Close', 38 | 'last-created' => 'Last Created', 39 | 'update-group' => 'Update Group', 40 | 'whiteboard' => 'WhiteBoard', 41 | 'send' => 'Send', 42 | 'search-conversation' => 'Search Conversation', 43 | 'name' => 'Name', 44 | 'departement' => 'Departement', 45 | 'email' => 'Email', 46 | 'status' => 'Status', 47 | 'search-using-mail' => 'Search using mail', 48 | 'about-me' => 'About me', 49 | 'created-at' => 'Created At', 50 | 'updated-at' => 'Updated At', 51 | 'select-all' => 'Select All', 52 | 'delete' => 'Delete', 53 | 'set-inactive' => 'Set Inactive', 54 | 'set-active' => 'Set active', 55 | 'block' => 'Block', 56 | 'unblock' => 'UnBlock', 57 | 'make-admin' => 'Make Admin', 58 | 'revoke-admin-power' => 'Revoke Admin Power', 59 | 'create-new-conversation' => 'Create New Conversation', 60 | 'action' => 'Action', 61 | 'departments' => 'Department\'s', 62 | 'add-and-delete-department' => 'Add and Delete Department', 63 | 'add-department' => 'Add Department', 64 | 'department' => 'Department', 65 | 'delete-department' => 'Delete Department', 66 | 'timezone' => 'Timezone', 67 | 'update-timezone' => 'Update Timezone', 68 | 'file-upload-path' => 'File Upload Path', 69 | 'place-it-outside-the-webroot-means-that-the-files-will-not-be-publicly-exposed' => 'Place it outside the webroot means that the files will not be publicly exposed.', 70 | 'notifications' => 'Notification\'s', 71 | 'activities' => 'Activitie\'s', 72 | 'superadmin' => 'SuperAdmin', 73 | 'change-password' => 'Change Password', 74 | ]; 75 | -------------------------------------------------------------------------------- /lang/hi/lang.php: -------------------------------------------------------------------------------- 1 | 'आपके सभी संदेश', 17 | 'all-your-total-conversations' => 'आपके सभी वार्तालाप', 18 | 'this-month' => 'इस महीने', 19 | 'total-users' => 'कुल उपयोगकर्ता', 20 | 'total-messages' => 'कुल संदेश', 21 | 'total-conversations' => 'कुल वार्तालाप', 22 | 'average-messages-per-user' => 'प्रति उपयोगकर्ता औसत संदेश', 23 | 'all-messages-per-day' => 'प्रतिदिन कुल संदेश', 24 | 'all-users-per-day' => 'प्रतिदिन सभी उपयोगकर्ता', 25 | 'all-conversations-per-day' => 'प्रतिदिन सभी वार्तालाप', 26 | 'all-your-messages-per-day' => 'प्रतिदिन आपके सभी संदेश', 27 | 'all-your-conversations-per-day' => 'प्रतिदिन आपके सभी वार्तालाप', 28 | 'dashboard' => 'डैशबोर्ड', 29 | 'messages' => 'संदेश', 30 | 'members' => 'सदस्यों', 31 | 'conversations' => 'वार्तालाप', 32 | 'settings' => 'सेटिंग्स', 33 | 'notification' => 'अधिसूचना', 34 | 'activity' => 'गतिविधि', 35 | 'profile' => 'प्रोफ़ाइल', 36 | 'logout' => 'लॉगआउट', 37 | 'close' => 'बंद करे', 38 | 'last-created' => 'अंतिम बनाया गया', 39 | 'update-group' => 'ग्रुप अपडेट करें', 40 | 'whiteboard' => 'सफेद बोर्ड', 41 | 'send' => 'भेजें', 42 | 'search-conversation' => 'वार्तालाप खोजें', 43 | 'name' => 'नाम', 44 | 'departement' => 'विभाग', 45 | 'email' => 'ईमेल', 46 | 'status' => 'स्थिति', 47 | 'search-using-mail' => 'मेल का उपयोग करके खोजें', 48 | 'about-me' => 'मेरे बारे में', 49 | 'created-at' => 'बनाया गया', 50 | 'updated-at' => 'अपडेट किया गया', 51 | 'select-all' => 'सभी का चयन करें', 52 | 'delete' => 'हटाएँ', 53 | 'set-inactive' => 'निष्क्रिय करें', 54 | 'set-active' => 'सक्रिय करें', 55 | 'block' => 'अवरोधित करें', 56 | 'unblock' => 'अवरोध हटाएँ', 57 | 'make-admin' => 'व्यवस्थापक बनाएँ', 58 | 'revoke-admin-power' => 'व्यवस्थापक अधिकार रद्द करें', 59 | 'create-new-conversation' => 'नई बातचीत बनाएँ', 60 | 'action' => 'कार्यवाही', 61 | 'departments' => 'विभागों', 62 | 'add-and-delete-department' => 'विभाग जोड़ें और हटाएँ', 63 | 'add-department' => 'विभाग जोड़ें', 64 | 'department' => 'विभाग', 65 | 'delete-department' => 'विभाग हटाएँ', 66 | 'timezone' => 'समय क्षेत्र', 67 | 'update-timezone' => 'समय क्षेत्र अपडेट करें', 68 | 'file-upload-path' => 'फ़ाइल अपलोड पथ', 69 | 'place-it-outside-the-webroot-means-that-the-files-will-not-be-publicly-exposed' => 'इसे वेबरूट के बाहर रखना यह मान लें कि फ़ाइलें सार्वजनिक रूप से प्रकट नहीं होंगी।', 70 | 'notifications' => 'सूचनाएं', 71 | 'activities' => 'गतिविधियां', 72 | 'superadmin' => 'सुपर व्यवस्थापक', 73 | 'change-password' => 'पासवर्ड बदलें', 74 | 'are-you-sure-you-want-to-delete-activities' => 'Are you sure you want to delete Activities', 75 | ]; 76 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'sync'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection information for each server that 24 | | is used by your application. A default configuration has been added 25 | | for each back-end shipped with Laravel. You are free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | 'after_commit' => false, 43 | ], 44 | 45 | 'beanstalkd' => [ 46 | 'driver' => 'beanstalkd', 47 | 'host' => 'localhost', 48 | 'queue' => 'default', 49 | 'retry_after' => 90, 50 | 'block_for' => 0, 51 | 'after_commit' => false, 52 | ], 53 | 54 | 'sqs' => [ 55 | 'driver' => 'sqs', 56 | 'key' => env('AWS_ACCESS_KEY_ID'), 57 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 58 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 59 | 'queue' => env('SQS_QUEUE', 'default'), 60 | 'suffix' => env('SQS_SUFFIX'), 61 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 62 | 'after_commit' => false, 63 | ], 64 | 65 | 'redis' => [ 66 | 'driver' => 'redis', 67 | 'connection' => 'default', 68 | 'queue' => env('REDIS_QUEUE', 'default'), 69 | 'retry_after' => 90, 70 | 'block_for' => null, 71 | 'after_commit' => false, 72 | ], 73 | 74 | ], 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Failed Queue Jobs 79 | |-------------------------------------------------------------------------- 80 | | 81 | | These options configure the behavior of failed queue job logging so you 82 | | can control which database and table are used to store the jobs that 83 | | have failed. You may change them to any database / table you wish. 84 | | 85 | */ 86 | 87 | 'failed' => [ 88 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 89 | 'database' => env('DB_CONNECTION', 'mysql'), 90 | 'table' => 'failed_jobs', 91 | ], 92 | 93 | ]; 94 | -------------------------------------------------------------------------------- /app/Http/Controllers/ConversationsController.php: -------------------------------------------------------------------------------- 1 | select('conversations.id as id','conversations.conversation_name as name','conversations.photo as photo','conversations.created_at as created_at',DB::raw('COUNT(p.user_id) as members')) 16 | ->rightJoin('conversations', 'participants.conversation_id', '=', 'conversations.id') 17 | ->rightJoin('participants as p', 'p.conversation_id', '=', 'conversations.id') 18 | ->where('participants.user_id',Auth()->user()->id) 19 | ->orderBy('conversations.created_at','DESC') 20 | ->groupBy('p.conversation_id') 21 | ->paginate(10); 22 | 23 | $pages = range(1, $conversations->lastPage()); 24 | 25 | if($request->role == 'admin'){ 26 | return view('admin.conversations',compact('conversations','pages')); 27 | } 28 | 29 | return view('user.conversations',compact('conversations','pages')); 30 | } 31 | 32 | function delete(Request $request){ 33 | 34 | if(isset($request->id)){ 35 | $request->ids = [$request->id]; 36 | } 37 | 38 | if(count($request->ids) == 0){ 39 | return json_encode(['error' => 'No conversation is selected']); 40 | } 41 | 42 | //This is to ensure that a user can only delete conversations in which he/she is a participant. 43 | $conversations = DB::table('participants') 44 | ->select('conversation_id') 45 | ->where('user_id',Auth()->user()->id) 46 | ->whereIn('conversation_id',$request->ids) 47 | ->get() 48 | ->toArray(); 49 | 50 | $ids = []; 51 | 52 | foreach($conversations as $k => $conversation){ 53 | $ids[] = $conversation->conversation_id; 54 | } 55 | 56 | $conversations = DB::table('conversations') 57 | ->select('id','conversation_name') 58 | ->whereIn('id',$ids) 59 | ->get() 60 | ->toArray(); 61 | 62 | $conversation_name = []; 63 | 64 | foreach($conversations as $conversation){ 65 | $conversation_name[$conversation->id] = $conversation->conversation_name; 66 | } 67 | 68 | $participants = DB::table('participants') 69 | ->select('conversation_id','user_id') 70 | ->whereIn('conversation_id',$ids) 71 | ->get() 72 | ->toArray(); 73 | 74 | ActivityLog::log()->save('Conversation','You have deleted conversation '.implode(',',$conversation_name).'.'); 75 | 76 | DB::table('conversations') 77 | ->whereIn('id',$ids) 78 | ->delete(); 79 | 80 | $tmp = []; 81 | 82 | foreach($participants as $participant){ 83 | $tmp[$conversation_name[$participant->conversation_id]][] = $participant->user_id; 84 | } 85 | 86 | foreach($tmp as $group => $ids){ 87 | NotificationsLog::log()->save($ids,'Conversation',Auth()->user()->email.' have deleted conversation '.$group.'.'); 88 | } 89 | 90 | return json_encode($participants); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | | Supported drivers: "apc", "array", "database", "file", 30 | | "memcached", "redis", "dynamodb", "octane", "null" 31 | | 32 | */ 33 | 34 | 'stores' => [ 35 | 36 | 'apc' => [ 37 | 'driver' => 'apc', 38 | ], 39 | 40 | 'array' => [ 41 | 'driver' => 'array', 42 | 'serialize' => false, 43 | ], 44 | 45 | 'database' => [ 46 | 'driver' => 'database', 47 | 'table' => 'cache', 48 | 'connection' => null, 49 | 'lock_connection' => null, 50 | ], 51 | 52 | 'file' => [ 53 | 'driver' => 'file', 54 | 'path' => storage_path('framework/cache/data'), 55 | ], 56 | 57 | 'memcached' => [ 58 | 'driver' => 'memcached', 59 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 60 | 'sasl' => [ 61 | env('MEMCACHED_USERNAME'), 62 | env('MEMCACHED_PASSWORD'), 63 | ], 64 | 'options' => [ 65 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 66 | ], 67 | 'servers' => [ 68 | [ 69 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 70 | 'port' => env('MEMCACHED_PORT', 11211), 71 | 'weight' => 100, 72 | ], 73 | ], 74 | ], 75 | 76 | 'redis' => [ 77 | 'driver' => 'redis', 78 | 'connection' => 'cache', 79 | 'lock_connection' => 'default', 80 | ], 81 | 82 | 'dynamodb' => [ 83 | 'driver' => 'dynamodb', 84 | 'key' => env('AWS_ACCESS_KEY_ID'), 85 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 86 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 87 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 88 | 'endpoint' => env('DYNAMODB_ENDPOINT'), 89 | ], 90 | 91 | 'octane' => [ 92 | 'driver' => 'octane', 93 | ], 94 | 95 | ], 96 | 97 | /* 98 | |-------------------------------------------------------------------------- 99 | | Cache Key Prefix 100 | |-------------------------------------------------------------------------- 101 | | 102 | | When utilizing the APC, database, memcached, Redis, or DynamoDB cache 103 | | stores there might be other applications using the same cache. For 104 | | that reason, you may prefix every cache key to avoid collisions. 105 | | 106 | */ 107 | 108 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), 109 | 110 | ]; 111 | -------------------------------------------------------------------------------- /resources/views/admin/activities.blade.php: -------------------------------------------------------------------------------- 1 | @extends('admin.master') 2 | 3 | @section('title', 'Activitie\'s') 4 | 5 | @section('header') 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | @endsection 14 | 15 | @section('body') 16 |
17 |
18 |
19 |
{{ __("lang.activities") }}
20 |
21 | 24 | 28 |
29 | 34 |
35 | @foreach($infos as $info) 36 |
37 |
38 | @if(isset($info->photo)) 39 | 42 | @endif 43 |
44 |
{{ $info->title }}
45 |
{{ $info->notification }}
46 |
47 | 48 |
49 | 52 | 56 |
57 |
58 |
{{ $info->updated_at }}
59 |
60 |
61 |
62 | @endforeach 63 |
64 |
65 | @endsection 66 | 67 | @section('script') 68 | 73 | @endsection 74 | -------------------------------------------------------------------------------- /resources/views/user/activities.blade.php: -------------------------------------------------------------------------------- 1 | @extends('user.master') 2 | 3 | @section('title', 'Activitie\'s') 4 | 5 | @section('header') 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | @endsection 14 | 15 | @section('body') 16 |
17 |
18 |
19 |
{{ __("lang.activities") }}
20 |
21 | 24 | 28 |
29 | 34 |
35 | @foreach($infos as $info) 36 |
37 |
38 | @if(isset($info->photo)) 39 | 42 | @endif 43 |
44 |
{{ $info->title }}
45 |
{{ $info->notification }}
46 |
47 | 48 |
49 | 52 | 56 |
57 |
58 |
{{ $info->updated_at }}
59 |
60 |
61 |
62 | @endforeach 63 |
64 |
65 | @endsection 66 | 67 | @section('script') 68 | 73 | @endsection 74 | -------------------------------------------------------------------------------- /resources/views/user/notifications.blade.php: -------------------------------------------------------------------------------- 1 | @extends('user.master') 2 | 3 | @section('title', __("lang.notification")) 4 | 5 | @section('header') 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | @endsection 14 | 15 | @section('body') 16 |
17 |
18 |
19 |
{{ __("lang.notifications") }}
20 |
21 | 24 | 28 |
29 | 34 |
35 | @foreach($infos as $info) 36 |
37 |
38 | @if(isset($info->photo)) 39 | 42 | @endif 43 |
44 |
{{ $info->title }}
45 |
{{ $info->notification }}
46 |
47 | 48 |
49 | 52 | 56 |
57 |
58 |
{{ $info->updated_at }}
59 |
60 |
61 |
62 | @endforeach 63 |
64 |
65 | @endsection 66 | 67 | @section('script') 68 | 73 | @endsection 74 | -------------------------------------------------------------------------------- /resources/views/admin/notifications.blade.php: -------------------------------------------------------------------------------- 1 | @extends('admin.master') 2 | 3 | @section('title', __("lang.notification")) 4 | 5 | @section('header') 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | @endsection 14 | 15 | @section('body') 16 |
17 |
18 |
19 |
{{ __("lang.notifications") }}
20 |
21 | 24 | 28 |
29 | 34 |
35 | @foreach($infos as $info) 36 |
37 |
38 | @if(isset($info->photo)) 39 | 42 | @endif 43 |
44 |
{{ $info->title }}
45 |
{{ $info->notification }}
46 |
47 | 48 |
49 | 52 | 56 |
57 |
58 |
{{ $info->updated_at }}
59 |
60 |
61 |
62 | @endforeach 63 |
64 |
65 | @endsection 66 | 67 | @section('script') 68 | 73 | @endsection 74 | -------------------------------------------------------------------------------- /resources/views/user/dashboard.blade.php: -------------------------------------------------------------------------------- 1 | @extends('user.master') 2 | 3 | @section('title', __("lang.dashboard")) 4 | 5 | @section('header') 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | @endsection 15 | 16 | @section('body') 17 |
18 | 19 |
20 |
21 |
22 |
23 |
24 |
{{ __("lang.all-your-total-message") }}
25 |

{{ $current_user_messages_count }}

26 |

{{ __("lang.this-month") }}{{ $current_user_messages_count_this_month }}

27 |
28 |
29 |
30 |
31 |
32 |
33 |
{{ __("lang.all-your-total-conversations") }}
34 |

{{ $current_user_conversations_count }}

35 |

{{ __("lang.this-month") }}{{ $current_user_new_conversations_this_month }}

36 |
37 |
38 |
39 |
40 |
41 |
42 | 43 |
44 |
45 |
46 |
47 |
48 |
49 | 50 |
51 |
52 |
53 |
54 |
55 |
56 | 81 | 106 | @endsection 107 | 108 | @section('script') 109 | 112 | @endsection 113 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_MAILER', 'smtp'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Mailer Configurations 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure all of the mailers used by your application plus 24 | | their respective settings. Several examples have been configured for 25 | | you and you are free to add your own as your application requires. 26 | | 27 | | Laravel supports a variety of mail "transport" drivers to be used while 28 | | sending an e-mail. You will specify which one you are using for your 29 | | mailers below. You are free to add additional mailers as required. 30 | | 31 | | Supported: "smtp", "sendmail", "mailgun", "ses", 32 | | "postmark", "log", "array", "failover" 33 | | 34 | */ 35 | 36 | 'mailers' => [ 37 | 'smtp' => [ 38 | 'transport' => 'smtp', 39 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 40 | 'port' => env('MAIL_PORT', 587), 41 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 42 | 'username' => env('MAIL_USERNAME'), 43 | 'password' => env('MAIL_PASSWORD'), 44 | 'timeout' => null, 45 | 'local_domain' => env('MAIL_EHLO_DOMAIN'), 46 | ], 47 | 48 | 'ses' => [ 49 | 'transport' => 'ses', 50 | ], 51 | 52 | 'mailgun' => [ 53 | 'transport' => 'mailgun', 54 | ], 55 | 56 | 'postmark' => [ 57 | 'transport' => 'postmark', 58 | ], 59 | 60 | 'sendmail' => [ 61 | 'transport' => 'sendmail', 62 | 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), 63 | ], 64 | 65 | 'log' => [ 66 | 'transport' => 'log', 67 | 'channel' => env('MAIL_LOG_CHANNEL'), 68 | ], 69 | 70 | 'array' => [ 71 | 'transport' => 'array', 72 | ], 73 | 74 | 'failover' => [ 75 | 'transport' => 'failover', 76 | 'mailers' => [ 77 | 'smtp', 78 | 'log', 79 | ], 80 | ], 81 | ], 82 | 83 | /* 84 | |-------------------------------------------------------------------------- 85 | | Global "From" Address 86 | |-------------------------------------------------------------------------- 87 | | 88 | | You may wish for all e-mails sent by your application to be sent from 89 | | the same address. Here, you may specify a name and address that is 90 | | used globally for all e-mails that are sent by your application. 91 | | 92 | */ 93 | 94 | 'from' => [ 95 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 96 | 'name' => env('MAIL_FROM_NAME', 'Example'), 97 | ], 98 | 99 | /* 100 | |-------------------------------------------------------------------------- 101 | | Markdown Mail Settings 102 | |-------------------------------------------------------------------------- 103 | | 104 | | If you are using Markdown based email rendering, you may configure your 105 | | theme and component paths here, allowing you to customize the design 106 | | of the emails. Or, you may simply stick with the Laravel defaults! 107 | | 108 | */ 109 | 110 | 'markdown' => [ 111 | 'theme' => 'default', 112 | 113 | 'paths' => [ 114 | resource_path('views/vendor/mail'), 115 | ], 116 | ], 117 | 118 | ]; 119 | -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => 'web', 18 | 'passwords' => 'users', 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | here which uses session storage and the Eloquent user provider. 29 | | 30 | | All authentication drivers have a user provider. This defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | mechanisms used by this application to persist your user's data. 33 | | 34 | | Supported: "session" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | ], 44 | 45 | /* 46 | |-------------------------------------------------------------------------- 47 | | User Providers 48 | |-------------------------------------------------------------------------- 49 | | 50 | | All authentication drivers have a user provider. This defines how the 51 | | users are actually retrieved out of your database or other storage 52 | | mechanisms used by this application to persist your user's data. 53 | | 54 | | If you have multiple user tables or models you may configure multiple 55 | | sources which represent each model / table. These sources may then 56 | | be assigned to any extra authentication guards you have defined. 57 | | 58 | | Supported: "database", "eloquent" 59 | | 60 | */ 61 | 62 | 'providers' => [ 63 | 'users' => [ 64 | 'driver' => 'eloquent', 65 | 'model' => App\Models\User::class, 66 | ], 67 | 68 | // 'users' => [ 69 | // 'driver' => 'database', 70 | // 'table' => 'users', 71 | // ], 72 | ], 73 | 74 | /* 75 | |-------------------------------------------------------------------------- 76 | | Resetting Passwords 77 | |-------------------------------------------------------------------------- 78 | | 79 | | You may specify multiple password reset configurations if you have more 80 | | than one user table or model in the application and you want to have 81 | | separate password reset settings based on the specific user types. 82 | | 83 | | The expire time is the number of minutes that each reset token will be 84 | | considered valid. This security feature keeps tokens short-lived so 85 | | they have less time to be guessed. You may change this as needed. 86 | | 87 | */ 88 | 89 | 'passwords' => [ 90 | 'users' => [ 91 | 'provider' => 'users', 92 | 'table' => 'password_resets', 93 | 'expire' => 60, 94 | 'throttle' => 60, 95 | ], 96 | ], 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Password Confirmation Timeout 101 | |-------------------------------------------------------------------------- 102 | | 103 | | Here you may define the amount of seconds before a password confirmation 104 | | times out and the user is prompted to re-enter their password via the 105 | | confirmation screen. By default, the timeout lasts for three hours. 106 | | 107 | */ 108 | 109 | 'password_timeout' => 10800, 110 | 111 | ]; 112 | -------------------------------------------------------------------------------- /resources/views/signon.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ __("login.lang00005") }} :: KChat 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |
19 |
20 | Phone image 22 |
23 |
24 |
25 | 26 |

{{ __("login.lang00007") }}? {{ __("login.lang00005") }}

27 | 29 |

{{ __("login.lang00008") }}

30 |
31 |
32 |
33 | 34 |
{{ __("login.lang00010") }}
35 |
36 |
37 |
38 |
39 | 40 |
{{ __("login.lang00017") }}
41 |
42 |
43 |
44 |
45 | 46 |
{{ __("login.lang00018") }}
47 |
48 |
49 |
50 |
51 | 52 |
{{ __("login.lang00019") }}
53 |
54 |
55 |
56 |
57 | 58 |
{{ __("login.lang00020") }}
59 |
60 |
61 |
62 |
63 | 64 |
{{ __("login.lang00021") }}
65 |
66 |
67 |
68 |
69 |
70 | 73 |
74 |
75 |
76 |
77 |
78 |
79 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /public/css/msg.css: -------------------------------------------------------------------------------- 1 | 2 | .card { 3 | background: #fff; 4 | transition: .5s; 5 | border: 0; 6 | margin-bottom: 30px; 7 | border-radius: .55rem; 8 | position: relative; 9 | width: 100%; 10 | box-shadow: 0 1px 2px 0 rgb(0 0 0 / 10%); 11 | } 12 | .chat-app .people-list { 13 | width: 280px; 14 | position: absolute; 15 | left: 0; 16 | top: 0; 17 | padding: 20px; 18 | z-index: 7 19 | } 20 | 21 | .chat-app .chat { 22 | margin-left: 280px; 23 | border-left: 1px solid #eaeaea 24 | } 25 | 26 | .people-list { 27 | -moz-transition: .5s; 28 | -o-transition: .5s; 29 | -webkit-transition: .5s; 30 | transition: .5s 31 | } 32 | 33 | .people-list .chat-list li { 34 | padding: 10px 15px; 35 | list-style: none; 36 | border-radius: 3px 37 | } 38 | 39 | .people-list .chat-list li:hover { 40 | background: #efefef; 41 | cursor: pointer 42 | } 43 | 44 | .people-list .chat-list li.active { 45 | background: #efefef 46 | } 47 | 48 | .people-list .chat-list li .name { 49 | font-size: 15px 50 | } 51 | 52 | .people-list .chat-list img { 53 | width: 45px; 54 | border-radius: 50% 55 | } 56 | 57 | .people-list img { 58 | float: left; 59 | border-radius: 50% 60 | } 61 | 62 | .people-list .about { 63 | float: left; 64 | padding-left: 8px 65 | } 66 | 67 | .people-list .status { 68 | color: #999; 69 | font-size: 13px 70 | } 71 | 72 | .chat .chat-header { 73 | padding: 15px 20px; 74 | border-bottom: 2px solid #f4f7f6 75 | } 76 | 77 | .chat .chat-header img { 78 | float: left; 79 | border-radius: 40px; 80 | width: 40px 81 | } 82 | 83 | .chat .chat-header .chat-about { 84 | float: left; 85 | padding-left: 10px 86 | } 87 | 88 | .chat .chat-history { 89 | padding: 20px; 90 | border-bottom: 2px solid #fff 91 | } 92 | 93 | .chat .chat-history ul { 94 | padding: 0 95 | } 96 | 97 | .chat .chat-history ul li { 98 | list-style: none; 99 | margin-bottom: 30px 100 | } 101 | 102 | .chat .chat-history ul li:last-child { 103 | margin-bottom: 0px 104 | } 105 | 106 | .chat .chat-history .message-data { 107 | margin-bottom: 15px 108 | } 109 | 110 | .chat .chat-history .message-data img { 111 | border-radius: 40px; 112 | width: 40px 113 | } 114 | 115 | .chat .chat-history .message-data-time { 116 | color: #434651; 117 | padding-left: 6px 118 | } 119 | 120 | .chat .chat-history .message { 121 | color: #444; 122 | padding: 18px 20px; 123 | line-height: 26px; 124 | font-size: 16px; 125 | border-radius: 7px; 126 | display: inline-block; 127 | position: relative 128 | } 129 | 130 | .chat .chat-history .message:after { 131 | bottom: 100%; 132 | left: 7%; 133 | border: solid transparent; 134 | content: " "; 135 | height: 0; 136 | width: 0; 137 | position: absolute; 138 | pointer-events: none; 139 | border-bottom-color: #fff; 140 | border-width: 10px; 141 | margin-left: -10px 142 | } 143 | 144 | .chat .chat-history .my-message { 145 | background: #efefef 146 | } 147 | 148 | .chat .chat-history .my-message:after { 149 | bottom: 100%; 150 | left: 30px; 151 | border: solid transparent; 152 | content: " "; 153 | height: 0; 154 | width: 0; 155 | position: absolute; 156 | pointer-events: none; 157 | border-bottom-color: #efefef; 158 | border-width: 10px; 159 | margin-left: -10px 160 | } 161 | 162 | .chat .chat-history .other-message { 163 | background: #e8f1f3; 164 | text-align: right 165 | } 166 | 167 | .chat .chat-history .other-message:after { 168 | border-bottom-color: #e8f1f3; 169 | left: 93% 170 | } 171 | 172 | .chat .chat-message { 173 | padding: 20px 174 | } 175 | 176 | .online, 177 | .offline, 178 | .me { 179 | margin-right: 2px; 180 | font-size: 8px; 181 | vertical-align: middle 182 | } 183 | 184 | .online { 185 | color: #86c541 186 | } 187 | 188 | .offline { 189 | color: #e47297 190 | } 191 | 192 | .me { 193 | color: #1d8ecd 194 | } 195 | 196 | .float-right { 197 | float: right 198 | } 199 | 200 | .clearfix:after { 201 | visibility: hidden; 202 | display: block; 203 | font-size: 0; 204 | content: " "; 205 | clear: both; 206 | height: 0 207 | } 208 | -------------------------------------------------------------------------------- /config/logging.php: -------------------------------------------------------------------------------- 1 | env('LOG_CHANNEL', 'stack'), 21 | 22 | /* 23 | |-------------------------------------------------------------------------- 24 | | Deprecations Log Channel 25 | |-------------------------------------------------------------------------- 26 | | 27 | | This option controls the log channel that should be used to log warnings 28 | | regarding deprecated PHP and library features. This allows you to get 29 | | your application ready for upcoming major versions of dependencies. 30 | | 31 | */ 32 | 33 | 'deprecations' => [ 34 | 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), 35 | 'trace' => false, 36 | ], 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Log Channels 41 | |-------------------------------------------------------------------------- 42 | | 43 | | Here you may configure the log channels for your application. Out of 44 | | the box, Laravel uses the Monolog PHP logging library. This gives 45 | | you a variety of powerful log handlers / formatters to utilize. 46 | | 47 | | Available Drivers: "single", "daily", "slack", "syslog", 48 | | "errorlog", "monolog", 49 | | "custom", "stack" 50 | | 51 | */ 52 | 53 | 'channels' => [ 54 | 'stack' => [ 55 | 'driver' => 'stack', 56 | 'channels' => ['single'], 57 | 'ignore_exceptions' => false, 58 | ], 59 | 60 | 'single' => [ 61 | 'driver' => 'single', 62 | 'path' => storage_path('logs/laravel.log'), 63 | 'level' => env('LOG_LEVEL', 'debug'), 64 | ], 65 | 66 | 'daily' => [ 67 | 'driver' => 'daily', 68 | 'path' => storage_path('logs/laravel.log'), 69 | 'level' => env('LOG_LEVEL', 'debug'), 70 | 'days' => 14, 71 | ], 72 | 73 | 'slack' => [ 74 | 'driver' => 'slack', 75 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 76 | 'username' => 'Laravel Log', 77 | 'emoji' => ':boom:', 78 | 'level' => env('LOG_LEVEL', 'critical'), 79 | ], 80 | 81 | 'papertrail' => [ 82 | 'driver' => 'monolog', 83 | 'level' => env('LOG_LEVEL', 'debug'), 84 | 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), 85 | 'handler_with' => [ 86 | 'host' => env('PAPERTRAIL_URL'), 87 | 'port' => env('PAPERTRAIL_PORT'), 88 | 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), 89 | ], 90 | ], 91 | 92 | 'stderr' => [ 93 | 'driver' => 'monolog', 94 | 'level' => env('LOG_LEVEL', 'debug'), 95 | 'handler' => StreamHandler::class, 96 | 'formatter' => env('LOG_STDERR_FORMATTER'), 97 | 'with' => [ 98 | 'stream' => 'php://stderr', 99 | ], 100 | ], 101 | 102 | 'syslog' => [ 103 | 'driver' => 'syslog', 104 | 'level' => env('LOG_LEVEL', 'debug'), 105 | ], 106 | 107 | 'errorlog' => [ 108 | 'driver' => 'errorlog', 109 | 'level' => env('LOG_LEVEL', 'debug'), 110 | ], 111 | 112 | 'null' => [ 113 | 'driver' => 'monolog', 114 | 'handler' => NullHandler::class, 115 | ], 116 | 117 | 'emergency' => [ 118 | 'path' => storage_path('logs/laravel.log'), 119 | ], 120 | 121 | ], 122 | 123 | ]; 124 | -------------------------------------------------------------------------------- /resources/views/login.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ __("login.lang00006") }} :: KChat 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |
19 |
20 | Phone image 22 |
23 |
24 |
25 |
26 |

{{ __("login.lang00000") }}

27 | 29 |
30 |

{{ __("login.lang00001") }}

31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 |
40 | 41 |
{{ __("login.lang00002") }}
42 |
43 |
44 |
45 | 46 | 47 | 48 | 49 | 50 | 51 |
52 | 53 |
{{ __("login.lang00003") }}
54 |
55 |
56 |
57 | 58 |
59 |
60 |
61 | 64 |
65 |
66 | 67 |
68 |
69 |
70 |
71 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /public/js/members.js: -------------------------------------------------------------------------------- 1 | 2 | function delete_users(){ 3 | kchat_alert("Are you sure you want to delete users?",(function(){__post('/members/delete_users',{'ids':{'ids':getSelectedID()}});})); 4 | } 5 | 6 | function set_inactive_users(){ 7 | kchat_alert("Are you sure you want to set inactive?",(function(){__post('/members/set_inactive_users',{'ids':getSelectedID()});})); 8 | } 9 | 10 | function set_active_users(){ 11 | kchat_alert("Are you sure you want to set active?",(function(){__post('/members/set_active_users',{'ids':getSelectedID()});})); 12 | } 13 | 14 | function block_users(){ 15 | kchat_alert("Are you sure you want to block users?",(function(){__post('/members/block_users',{'ids':getSelectedID()});})); 16 | } 17 | 18 | function unblock_users(){ 19 | kchat_alert("Are you sure you want to unblock users?",(function(){__post('/members/unblock_users',{'ids':getSelectedID()});})); 20 | } 21 | 22 | function NewConversation(){ 23 | kchat_alert("Are you sure you want to start new Conversation?",(function(){ 24 | Data = {}; 25 | Data['ids'] = getSelectedID(); 26 | Data['grpname'] = $('#grpname').val(); 27 | __post('/members/newconversation',Data); 28 | })); 29 | } 30 | 31 | function revoke_admins(){ 32 | kchat_alert("Are you sure you want to revoke admin privileges?",(function(){__post('/members/revokeadmin',{'ids':getSelectedID()});})); 33 | } 34 | 35 | function make_admins(){ 36 | kchat_alert("Are you sure you want to grant admin privileges?",(function(){__post('/members/makeadmin',{'ids':getSelectedID()});})); 37 | } 38 | 39 | function delete_user(){ 40 | kchat_alert("Are you sure you want to delete users?",(function(){__post('/members/delete_users',[$('#m_user').val()]);})); 41 | } 42 | 43 | function set_inactive_user(){ 44 | kchat_alert("Are you sure you want to set inactive?",(function(){__post('/members/set_inactive_users',[$('#m_user').val()]);})); 45 | } 46 | 47 | function set_active_user(){ 48 | kchat_alert("Are you sure you want to set active?",(function(){__post('/members/set_active_users',[$('#m_user').val()]);})); 49 | } 50 | 51 | function block_user(){ 52 | kchat_alert("Are you sure you want to block user?",(function(){__post('/members/block_users',[$('#m_user').val()]);})); 53 | } 54 | 55 | function unblock_user(){ 56 | kchat_alert("Are you sure you want to unblock user?",(function(){__post('/members/unblock_users',[$('#m_user').val()]);})); 57 | } 58 | 59 | function make_admin(){ 60 | kchat_alert("Are you sure you want to grant admin privileges?",(function(){__post('/members/makeadmin',[$('#m_user').val()]);})); 61 | } 62 | 63 | function revoke_admin(){ 64 | kchat_alert("Are you sure you want to revoke admin privileges?",(function(){__post('/members/revokeadmin',[$('#m_user').val()]);})); 65 | } 66 | 67 | $(document).ready(function(){ 68 | 69 | $(document).on('dblclick', '.member', function() { 70 | $('.m_photo').attr('src',json[$(this).attr('id')].photo); 71 | $('.m_about').text(json[$(this).attr('id')].about); 72 | $('.m_name').text(json[$(this).attr('id')].first_name + " " + json[$(this).attr('id')].last_name); 73 | $('.m_email').text(json[$(this).attr('id')].email); 74 | $('.m_department').text(json[$(this).attr('id')].department); 75 | $('.m_phone').text(json[$(this).attr('id')].phone); 76 | $('.m_status').text(json[$(this).attr('id')].status); 77 | $('.m_status').removeClass("bg-Active bg-Blocked bg-Inactive"); 78 | $('.m_status').addClass("bg-"+json[$(this).attr('id')].status); 79 | $('#m_user').val($(this).attr('id')); 80 | $('.m_created_at').text(getRelativeTime(json[$(this).attr('id')].created_at)); 81 | $('.m_updated_at').text(getRelativeTime(json[$(this).attr('id')].updated_at)); 82 | }); 83 | 84 | $(document).on('keyup', '#Member-rearch', function() { 85 | 86 | Data = {}; 87 | 88 | Data['_token'] = $('meta[name="csrf_token"]').attr('content'); 89 | 90 | Data['ms'] = $(this).val(); 91 | 92 | $.ajax({ 93 | type: "POST", 94 | url: '/ajax_members', 95 | data: Data, 96 | success: function(result){ 97 | $("#member_table").html(result); 98 | }, 99 | error: function(result){ 100 | 101 | } 102 | }); 103 | }); 104 | }); -------------------------------------------------------------------------------- /resources/views/user/master.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | @yield('title') :: KChat 6 | 7 | 8 | @yield('header') 9 | 10 | 11 | 12 | 13 |
14 |
15 | 63 |
64 |
65 | 66 | 67 | 84 | @yield('script') 85 | 86 | @yield('javascript') 87 | 88 | 89 | -------------------------------------------------------------------------------- /resources/views/admin/master.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | @yield('title') :: KChat 6 | 7 | 8 | @yield('header') 9 | 10 | 11 | 12 | 13 |
14 |
15 | 67 |
68 |
69 | 70 | 71 | 88 | @yield('script') 89 | 90 | @yield('javascript') 91 | 92 | 93 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | ['GoIn']],function(){ 26 | 27 | Route::get('/login', function () { return view('login'); }); 28 | 29 | Route::get('/sign-on', function () { return view('signon'); }); 30 | 31 | Route::post('/login', [AuthController::class, 'login'])->name('Login'); 32 | 33 | Route::post('/sign-on', [AuthController::class, 'signon'])->name('Sign-On'); 34 | 35 | }); 36 | 37 | Route::group(['middleware' => ['CheckLogin']],function(){ 38 | 39 | Route::group(['middleware' => ['GetCounts']],function(){ 40 | 41 | Route::get('/', [DashboardController::class, 'index'])->name('Dashboard'); 42 | 43 | Route::get('/members', [UserController::class, 'members'])->name('Members List'); 44 | 45 | Route::get('/activity', [ActivityController::class, 'activity'])->name('Activities'); 46 | 47 | Route::get('/notification', [NotificationController::class, 'notification'])->name('Notification\'s'); 48 | 49 | Route::get('/settings', [SettingController::class, 'Setting'])->name('Setting\'s'); 50 | 51 | Route::get('/profile', [UserController::class, 'profile'])->name('Profile'); 52 | 53 | Route::get('/messages', [MessageController::class, 'messages'])->name('Messages Controller'); 54 | 55 | Route::get('/conversations', [ConversationsController::class, 'Conversations'])->name('Conversations Controller'); 56 | 57 | Route::get('/messages/downattch/{uuid}', [KchatController::class, 'downattch'])->name('Attachments Download')->where('uuid', '[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}')->withoutMiddleware('GetCounts'); 58 | 59 | }); 60 | 61 | Route::post('/logout', [AuthController::class, 'logout'])->name('Logout'); 62 | 63 | Route::post('/members/delete_users', [UserController::class, 'delete_users'])->name('Delete Members'); 64 | 65 | Route::post('/members/set_inactive_users', [UserController::class, 'set_inactive_users'])->name('Set Inactive Members'); 66 | 67 | Route::post('/members/set_active_users', [UserController::class, 'set_active_users'])->name('Set Active Members'); 68 | 69 | Route::post('/members/block_users', [UserController::class, 'block_users'])->name('Block Members'); 70 | 71 | Route::post('/members/unblock_users', [UserController::class, 'unblock_users'])->name('Unblock Members'); 72 | 73 | Route::post('/members/makeadmin', [UserController::class, 'MakeAdmin'])->name('Admin access grant'); 74 | 75 | Route::post('/members/revokeadmin', [UserController::class, 'RevokeAdmin'])->name('Revoke access Power'); 76 | 77 | Route::post('/members/newconversation', [UserController::class, 'NewConversation'])->name('New Conversation'); 78 | 79 | Route::post('/profile', [UserController::class, 'SaveProfile'])->name('Save Profile'); 80 | 81 | Route::post('/setting/savedpt', [SettingController::class, 'AddDepartment'])->name('Add Department'); 82 | 83 | Route::post('/setting/timezone', [SettingController::class, 'TimeZone'])->name('TimeZone'); 84 | 85 | Route::post('/setting/deletedpt', [SettingController::class, 'DeleteDepartment'])->name('Delete Department'); 86 | 87 | Route::post('/setting/uploadpath ', [SettingController::class, 'UploadPath'])->name('Uplaod Path'); 88 | 89 | Route::post('/activity/delete', [ActivityController::class, 'delete'])->name('Delete Activities'); 90 | 91 | Route::post('/notification/delete', [NotificationController::class, 'delete'])->name('Delete Notification\'s'); 92 | 93 | Route::post('/messages', [KchatController::class, 'kchat'])->name('All Json Responses'); 94 | 95 | Route::post('/messages/attachments', [KchatController::class, 'attachments'])->name('Chat\'s attachments'); 96 | 97 | Route::post('/messages/update', [MessageController::class, 'UpdateConversation'])->name('Update Conversation'); 98 | 99 | Route::post('/getConvo', [KchatController::class, 'getConvo'])->name('get Conversations list via search'); 100 | 101 | Route::post('/ajax_members', [UserController::class, 'members_ajax'])->name('Members List on Ajax call'); 102 | 103 | Route::post('/conversations/delete', [ConversationsController::class, 'delete'])->name('Conversations Controller'); 104 | 105 | }); -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | env('DB_CONNECTION', 'mysql'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Database Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here are each of the database connections setup for your application. 26 | | Of course, examples of configuring each database platform that is 27 | | supported by Laravel is shown below to make development simple. 28 | | 29 | | 30 | | All database work in Laravel is done through the PHP PDO facilities 31 | | so make sure you have the driver for your particular database of 32 | | choice installed on your machine before you begin development. 33 | | 34 | */ 35 | 36 | 'connections' => [ 37 | 38 | 'sqlite' => [ 39 | 'driver' => 'sqlite', 40 | 'url' => env('DATABASE_URL'), 41 | 'database' => env('DB_DATABASE', database_path('database.sqlite')), 42 | 'prefix' => '', 43 | 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), 44 | ], 45 | 46 | 'mysql' => [ 47 | 'driver' => 'mysql', 48 | 'url' => env('DATABASE_URL'), 49 | 'host' => env('DB_HOST', '127.0.0.1'), 50 | 'port' => env('DB_PORT', '3306'), 51 | 'database' => env('DB_DATABASE', 'forge'), 52 | 'username' => env('DB_USERNAME', 'forge'), 53 | 'password' => env('DB_PASSWORD', ''), 54 | 'unix_socket' => env('DB_SOCKET', ''), 55 | 'charset' => 'utf8mb4', 56 | 'collation' => 'utf8mb4_unicode_ci', 57 | 'prefix' => '', 58 | 'prefix_indexes' => true, 59 | 'strict' => true, 60 | 'engine' => null, 61 | 'options' => extension_loaded('pdo_mysql') ? array_filter([ 62 | PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), 63 | ]) : [], 64 | ], 65 | 66 | 'pgsql' => [ 67 | 'driver' => 'pgsql', 68 | 'url' => env('DATABASE_URL'), 69 | 'host' => env('DB_HOST', '127.0.0.1'), 70 | 'port' => env('DB_PORT', '5432'), 71 | 'database' => env('DB_DATABASE', 'forge'), 72 | 'username' => env('DB_USERNAME', 'forge'), 73 | 'password' => env('DB_PASSWORD', ''), 74 | 'charset' => 'utf8', 75 | 'prefix' => '', 76 | 'prefix_indexes' => true, 77 | 'search_path' => 'public', 78 | 'sslmode' => 'prefer', 79 | ], 80 | 81 | 'sqlsrv' => [ 82 | 'driver' => 'sqlsrv', 83 | 'url' => env('DATABASE_URL'), 84 | 'host' => env('DB_HOST', 'localhost'), 85 | 'port' => env('DB_PORT', '1433'), 86 | 'database' => env('DB_DATABASE', 'forge'), 87 | 'username' => env('DB_USERNAME', 'forge'), 88 | 'password' => env('DB_PASSWORD', ''), 89 | 'charset' => 'utf8', 90 | 'prefix' => '', 91 | 'prefix_indexes' => true, 92 | // 'encrypt' => env('DB_ENCRYPT', 'yes'), 93 | // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), 94 | ], 95 | 96 | ], 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Migration Repository Table 101 | |-------------------------------------------------------------------------- 102 | | 103 | | This table keeps track of all the migrations that have already run for 104 | | your application. Using this information, we can determine which of 105 | | the migrations on disk haven't actually been run in the database. 106 | | 107 | */ 108 | 109 | 'migrations' => 'migrations', 110 | 111 | /* 112 | |-------------------------------------------------------------------------- 113 | | Redis Databases 114 | |-------------------------------------------------------------------------- 115 | | 116 | | Redis is an open source, fast, and advanced key-value store that also 117 | | provides a richer body of commands than a typical key-value system 118 | | such as APC or Memcached. Laravel makes it easy to dig right in. 119 | | 120 | */ 121 | 122 | 'redis' => [ 123 | 124 | 'client' => env('REDIS_CLIENT', 'phpredis'), 125 | 126 | 'options' => [ 127 | 'cluster' => env('REDIS_CLUSTER', 'redis'), 128 | 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), 129 | ], 130 | 131 | 'default' => [ 132 | 'url' => env('REDIS_URL'), 133 | 'host' => env('REDIS_HOST', '127.0.0.1'), 134 | 'username' => env('REDIS_USERNAME'), 135 | 'password' => env('REDIS_PASSWORD'), 136 | 'port' => env('REDIS_PORT', '6379'), 137 | 'database' => env('REDIS_DB', '0'), 138 | ], 139 | 140 | 'cache' => [ 141 | 'url' => env('REDIS_URL'), 142 | 'host' => env('REDIS_HOST', '127.0.0.1'), 143 | 'username' => env('REDIS_USERNAME'), 144 | 'password' => env('REDIS_PASSWORD'), 145 | 'port' => env('REDIS_PORT', '6379'), 146 | 'database' => env('REDIS_CACHE_DB', '1'), 147 | ], 148 | 149 | ], 150 | 151 | ]; 152 | -------------------------------------------------------------------------------- /resources/views/user/conversations.blade.php: -------------------------------------------------------------------------------- 1 | @extends('user.master') 2 | 3 | @section('title', __("lang.conversations")) 4 | 5 | @section('header') 6 | 7 | 8 | 9 | 10 | 11 | 12 | @endsection 13 | 14 | @section('body') 15 |
16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 31 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | @foreach($conversations as $conversation) 59 | 60 | 61 | 62 | 63 | 64 | 78 | 79 | @endforeach 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 94 | 95 | 96 |
25 | 30 | 32 | 45 |
#{{ __("lang.name") }}{{ __("lang.members") }}Created at{{ __("lang.action") }}
[Photo]{{ $conversation->name }}{{ $conversation->members }}{{ $conversation->created_at }} 65 | 77 |
88 | 93 |
97 |
98 |
99 | @endsection 100 | 101 | @section('script') 102 | @endsection 103 | -------------------------------------------------------------------------------- /resources/views/admin/conversations.blade.php: -------------------------------------------------------------------------------- 1 | @extends('admin.master') 2 | 3 | @section('title', __("lang.conversations")) 4 | 5 | @section('header') 6 | 7 | 8 | 9 | 10 | 11 | 12 | @endsection 13 | 14 | @section('body') 15 |
16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 31 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | @foreach($conversations as $conversation) 59 | 60 | 61 | 62 | 63 | 64 | 78 | 79 | @endforeach 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 94 | 95 | 96 |
25 | 30 | 32 | 45 |
#{{ __("lang.name") }}{{ __("lang.members") }}Created at{{ __("lang.action") }}
[Photo]{{ $conversation->name }}{{ $conversation->members }}{{ $conversation->created_at }} 65 | 77 |
88 | 93 |
97 |
98 |
99 | @endsection 100 | 101 | @section('script') 102 | @endsection 103 | -------------------------------------------------------------------------------- /public/logo/KChat.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | --------------------------------------------------------------------------------