php - Method groups does not exist error in Laravel 5.2 -
i working on laravel 5.2.i want display members belongs particular group open @ time. actually, getting members have stored in database but, want access or display members belongs particular on accessing. getting error: method groups not exist. shown below: my controller: public function members($id){ $dashes=grouptable::findorfail($id); $members=member::all(); return view('members' , ['dashes'=>$dashes,'members'=>$members]); } public function dashboard($id){ $dashes=grouptable::findorfail($id); return view('dashboard' , ['dashes'=>$dashes]); } public function addmembers(request $request){ $member=new member(); $member->members=$request['addmember']; $request->groups()->members()->save($member); return redirect()->back(); } my view: <body> <div class="row"> <div class="col-lg-3 col-lg-offset-1&qu