How can i user a scope in the with()?

i definded a scope in User model,just like :

public function sID($id)




and in controller group,i want use this scope in with()


but i don’t know how to call the sID function in the model User.

Please help!

Thank you!




You can’t use parameterized scopes in with(), only those defined in scopes(). See the section at the bottom of this page: