bug fix 5 in clients show view
This commit is contained in:
@@ -219,21 +219,13 @@ class ClientsController extends Controller
|
||||
->take(1)
|
||||
->get();
|
||||
|
||||
$voice_codes = Models\ClientShortCode::where('client_id', $id)
|
||||
->where('code_type', 'voice')
|
||||
->get();
|
||||
#$voice_codes = Models\ClientShortCode::where('client_id', $id)->where('code_type', 'voice') ->get();
|
||||
|
||||
$sms_codes = Models\ClientShortCode::where('client_id', $id)
|
||||
->where('code_type', 'sms')
|
||||
->get();
|
||||
#$sms_codes = Models\ClientShortCode::where('client_id', $id)->where('code_type', 'sms')->get();
|
||||
|
||||
$ussd_codes = Models\ClientShortCode::where('client_id', $id)
|
||||
->where('code_type', 'ussd')
|
||||
->get();
|
||||
#$ussd_codes = Models\ClientShortCode::where('client_id', $id)->where('code_type', 'ussd')->get();
|
||||
|
||||
$recent_payments = Models\ClientPayment::where('client_id', $id)
|
||||
->latest('id')
|
||||
->get();
|
||||
#$recent_payments = Models\ClientPayment::where('client_id', $id)->latest('id')->get();
|
||||
|
||||
$countries = Models\Country::pluck('en_short_name', 'en_short_name');
|
||||
$networks = Models\NetworkOperator::pluck('name', 'id');
|
||||
@@ -242,7 +234,18 @@ class ClientsController extends Controller
|
||||
->latest('id')
|
||||
->get();
|
||||
|
||||
$showdocuments = Models\ClientFile::where('client_id', $id)->get();
|
||||
#$showdocuments = Models\ClientFile::where('client_id', $id)->get();
|
||||
|
||||
// Force these to always be collections/arrays so count() never fails
|
||||
$voice_codes = Models\ClientShortCode::where('client_id', $id)->where('code_type', 'voice')->get() ?? collect();
|
||||
$sms_codes = Models\ClientShortCode::where('client_id', $id)->where('code_type', 'sms')->get() ?? collect();
|
||||
$ussd_codes = Models\ClientShortCode::where('client_id', $id)->where('code_type', 'ussd')->get() ?? collect();
|
||||
$recent_payments = Models\ClientPayment::where('client_id', $id)->latest('id')->get() ?? collect();
|
||||
$showdocuments = Models\ClientFile::where('client_id', $id)->get() ?? collect();
|
||||
|
||||
// Also ensure client attributes are safe arrays
|
||||
$showclient->services = is_array($showclient->services) ? $showclient->services : (json_decode($showclient->services, true) ?? []);
|
||||
$showclient->message_types = is_array($showclient->message_types) ? $showclient->message_types : (json_decode($showclient->message_types, true) ?? []);
|
||||
|
||||
$status_bg = match ($showclient->status) {
|
||||
'Live' => 'info',
|
||||
|
||||
Reference in New Issue
Block a user