Я не понимаю, где я делаю ошибку. Почему информация не отображается на странице просмотра. Я получаю эту ошибку:
Trying to get property 'patient_image' of non-object (View: C:\xampp\htdocs\HealthCare\resources\views\backEnd\appointment\viewAppointment.blade.php)
Мой контроллер:
public function appointmentView($id)
{
$appDetails = DB::table('appointments')
->where('appointments.patient_id',$id)
->join('patients', 'appointments.patient_id', '=', 'patients.patient_userID')
->select('appointments.*','patients.*')
->get()
->first();
$doctorsLists = Doctor::groupBy('doctor_specialty')->get()->all();
$specialityLists = Specialist::get()->all();
return view('backEnd.appointment.viewAppointment',['appDetails'=>$appDetails, 'doctorsLists'=>$doctorsLists , 'specialityLists'=>$specialityLists]);
}
Маршрутизатор. php
Route::get('/admin/appointment/view/{id}', 'AppointmentController@appointmentView');
Просмотр страницы:
<div class="profile-info-detail">
<img src="{{asset($appDetails-> patient_image)}}"
class="img-thumbnail" alt="profile-image">
<h4 class="m-0"> {{$appDetails->patient_name}}</h4>
<p class="text-muted m-b-20"><i><strong>Email : </strong>{{$appDetails->patient_email}}</i></p>
<p class="text-muted m-b-20"><i><strong>Phone : </strong> {{$appDetails->patient_phone}}</i></p>
<p class="text-muted m-b-20"><i><strong>Diseases Type : </strong> {{$appDetails->diseases_type}}</i></p>
<p class="text-muted m-b-20"><i><strong>Appointment Date : </strong> {{$appDetails->app_date}}</i></p>
<p><strong>Problem Description:</strong> {{$appDetails->message}}</p>
</div>