imporve first message

This commit is contained in:
2024-06-03 11:09:51 +07:00
parent 6f711b592e
commit 1eb6eb9cf3
2 changed files with 45 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ use App\Models\Organization;
use App\Models\Speciality;
use App\Models\Livechat;
use App\Models\Channel;
use App\Models\Message;
use App\Models\UserChannel;
use App\Models\User as UserAso;
use App\Models\OLDLMS\User;
@@ -277,7 +278,8 @@ class DuitkuController extends Controller
header('Content-Type: application/json');
$notif = json_decode($callback);
// $notif = $request; ini untuk di local
// $notif = $request; //ini untuk di local
// $callback = $notif; //ini untuk di local
DB::table('api_logs')
->insert([
@@ -298,7 +300,6 @@ class DuitkuController extends Controller
$livechat->start_date = date('Y-m-d H:i:s');
$livechat->save();
// Send Notification
$doctorId = $livechat->doctor_id;
$userDokter = UserAso::where('person_id',$doctorId)->first();
@@ -314,6 +315,16 @@ class DuitkuController extends Controller
'livechat_id' => (string) $livechat->id,
'type' => 'success-payment'
];
$question = $livechat->descriptions;
// Ambil data dari request
$message = Message::create([
'content' => $question,
'from_user' => $livechat->patient_id,
'channel_id' => $channel->id,
'type' => 'first_chat'
]);
$userDokter->notify(new SendNotification($title, $body, $dataNotif));
$patient->notify(new SendNotification($title, $body, $dataNotif));

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('notification_tokens', function (Blueprint $table) {
$table->string('device_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('notification_tokens', function (Blueprint $table) {
$table->dropColumn('device_id');
});
}
};