User Model
public function teachers()
{
return $this->hasMany(Teacher::class);
}
Teacher Model
public function user(){
return $this->belongsTo(User::class);
}
TeacherController
public function index()
{
$role_user = DB::table('roles')->where('role', 'teacher')->first();
$role_id = $role_user->id;
$users = User::all()->where('role_id',$role_id);
return view('admin.teacher.index')
->with('users',$users);
}
In View
<td class="d-none d-sm-table-cell">{{dd( $teacher->teachers->designation)}}</td>
It Gives An Error like this
Property [designation] does not exist on this collection instance