I am getting this error of undefined variable in the View even though i have retrieved the data from table in the doctorAppointment model and then passed it to Controller and then controller passed it further to view. This is the model
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class doctorAppointment extends Model
{
public function user()
{
return $this->belongsTo('App\User');
}
}
this is my controller
class AppointmentController extends Controller
{
public function GetAppointment()
{
$doctorAppointment= doctorAppointment::all();
return view('dashboard',array('appointments'=>$doctorAppointment));
}
}
this is my view
@foreach($appointments as $appointment)
<p>{$appointment->patientEmail}</p>
@endforeach
this is my route
Route::get('/dashboard', 'AppointmentController@GetAppointment');
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire