when i get data from database and get dates from course_dates table show data and sometime show empty
^ Illuminate\Database\Eloquent\Collection {#1445 ▼
#items: []
}
when I do refresh to the page show data in laravel
$allCourses = VCourse::with('getDate')->get();
class courseDate extends Model
{
protected $table = 'course_dates';
const CREATED_AT = 'dt_created_date';
const UPDATED_AT = 'dt_modified_date';
public $primaryKey = 'pk_i_id';
protected $guarded=[];
public function course()
{
return $this->belongsTo(VCourse::class, "fk_course_id", "pk_i_id");
}
class VCourse extends Model
{
public function getDate()
{
return $this->hasMany(courseDate::class, "fk_course_id", "pk_i_id");
}