How to get 1st record in many-to-many rel. using Laravel?
my model public function semesters(): BelongsToMany { return $this->belongsToMany(Semester::class) ->orderBy('name', 'desc'); } my controller code $semesters = Auth::guard('student')->user()->semesters; my blade code is {{ dd($semesters->name) }} and the error is Property [name] does not exist on this collection instance. my expectation…