| Server IP : 46.62.235.243 / Your IP : 216.73.216.217 Web Server : Apache/2.4.58 (Ubuntu) System : Linux Linkabili3Dicembre 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/linkabili/app/Services/ |
Upload File : |
<?php
namespace App\Services;
use App\Models\User;
use DB;
class ContactCareGiverProfessionService {
public function GetContact($id = null) {
$contacts = DB::table('contact_caregivers_professionist as ccp')
->select(DB::raw("ucg.email as caregiver_email,"
. "up.email as professionist_email,"
. "up.path_url as path_url,"
. "ucgd.tel_referent as caregiver_tel,"
. "upd.tel_referent as professionist_tel,"
. "up.slug as professionist_slug,"
. 'IF(upd.business_name IS NOT NULL,1,0) as business,'
. 'IF(upd.business_name IS NOT NULL, upd.business_name , CONCAT(up.name," ",up.surname)) as name,'
. "ccp.created_at,ccp.caregiver_id as idc,ccp.professionist_id as idp,DATE_FORMAT(ccp.created_at, '%d/%m/%Y %H:%i:%s') as created_custom"))
->leftjoin('users as ucg', function($join) {
$join->on('ucg.id', 'ccp.caregiver_id');
})
->leftjoin('users as up', function($join) {
$join->on('up.id', 'ccp.professionist_id');
})
->leftjoin('user_details as ucgd', function($join) {
$join->on('ucgd.user_id', 'ucg.id');
})
->leftjoin('user_details as upd', function($join) {
$join->on('upd.user_id', 'up.id');
})
->leftjoin('medical_centers as mc', function($join) {
$join->on('mc.id', 'upd.medical_center_id');
})->groupBy('ccp.id')->orderby('ccp.created_at','DESC');
if ($id) {
$contacts = $contacts->where('ccp.caregiver_id', $id);
}
return $contacts;
}
}