Jaxel Well-known member Feb 17, 2018 #1 Is it possible to pluckFrom a relationship? I'm getting getter warnings on this. Code: $admins = $this->getAdminRepo()->findAdmin() ->where('league_id', $league->league_id) ->pluckFrom('User.username') ->fetch();
Is it possible to pluckFrom a relationship? I'm getting getter warnings on this. Code: $admins = $this->getAdminRepo()->findAdmin() ->where('league_id', $league->league_id) ->pluckFrom('User.username') ->fetch();
Liam W in memoriam 1998-2020 Feb 18, 2018 #2 I think you'd have to use your own closure, based on the implementation: PHP: $admins = $this->getAdminRepo()->findAdmin() ->where('league_id', $league->league_id) ->pluckFrom(function(Admin $admin) {return $admin->User->username;}) ->fetch(); Liam
I think you'd have to use your own closure, based on the implementation: PHP: $admins = $this->getAdminRepo()->findAdmin() ->where('league_id', $league->league_id) ->pluckFrom(function(Admin $admin) {return $admin->User->username;}) ->fetch(); Liam
Liam W in memoriam 1998-2020 Feb 18, 2018 #4 Jaxel said: Nope, didn't work. Click to expand... Did you look before or after my edit? You have to use your own closure, the string method won't work (not valid PHP). Liam
Jaxel said: Nope, didn't work. Click to expand... Did you look before or after my edit? You have to use your own closure, the string method won't work (not valid PHP). Liam