fix private channel
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Linksehat\Http\Controllers\Api\Doctor;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use App\Models\Livechat;
|
||||
use Crypt;
|
||||
use Error;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Modules\Internal\Emails\SendVerifyEmail;
|
||||
use Modules\Internal\Events\ForgetPassword;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Modules\HospitalPortal\Helpers\ApiResponse;
|
||||
use App\Helpers\Helper;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ChatDoctorController extends Controller
|
||||
{
|
||||
public function getChat()
|
||||
{
|
||||
$data = [
|
||||
'user_id' => auth()->check() ? auth()->user()->id : null,
|
||||
];
|
||||
$user_id = auth()->check() ? auth()->user()->id : null;
|
||||
//Get data Chat
|
||||
$user = User::where('id',$user_id)->with('person')->first();
|
||||
$chat = Livechat::where([
|
||||
'doctor_id'=> $user->person_id,
|
||||
'accept_date'=> null,
|
||||
])->get()->toArray();
|
||||
dd($chat);
|
||||
|
||||
return ApiResponse::apiResponse("Success", $res_data, trans('Message.success'), 200);
|
||||
|
||||
}
|
||||
public function fWorkExperience($start, $end)
|
||||
{
|
||||
$startDateString = $start; // Tanggal dan waktu awal
|
||||
$endDateString = $end ; // Tanggal dan waktu akhir
|
||||
|
||||
// Mengubah string tanggal ke timestamp UNIX
|
||||
$startTime = strtotime($startDateString);
|
||||
$endTime = strtotime($endDateString);
|
||||
|
||||
// Menghitung selisih waktu dalam detik
|
||||
$timeDifference = $endTime - $startTime;
|
||||
|
||||
// Menghitung jumlah tahun, bulan, dan hari dari selisih waktu
|
||||
$years = floor($timeDifference / (365 * 24 * 60 * 60));
|
||||
$months = floor(($timeDifference - ($years * 365 * 24 * 60 * 60)) / (30 * 24 * 60 * 60));
|
||||
$days = floor(($timeDifference - ($years * 365 * 24 * 60 * 60) - ($months * 30 * 24 * 60 * 60)) / (24 * 60 * 60));
|
||||
|
||||
// Formatkan hasilnya
|
||||
$experience = '';
|
||||
if ($years > 0) {
|
||||
$experience .= $years . ' years ';
|
||||
}
|
||||
if ($months > 0) {
|
||||
$experience .= $months . ' months ';
|
||||
}
|
||||
if ($days > 0) {
|
||||
$experience .= $days . ' days';
|
||||
}
|
||||
|
||||
return $experience;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user