mel47 Posted February 23, 2021 Share Posted February 23, 2021 (edited) Hi, I have this working line to find a specific image. $banniere = $pages->get(1)->images->findTag('banniere')->getTag($user->language->name); But now, I want to add getRandom(). I tried different versions $pages->get(1)->images->findTag('banniere')->getTag($user->language->name)->getRandom() $pages->get(1)->images->getRandom()->findTag('banniere')->getTag($user->language->name) but always received this error : Method Pageimage::getRandom does not exist or is not callable in this context. Is it compatible? How I can do that? Thanks! Mel EDIT : solved by myself. Error I commonly do, mixing up get() and find()... Sorry for the disturbance. $banniere = $pages->get(1)->images->findTag('banniere')->findTag($user->language->name)->getRandom(); Edited February 23, 2021 by mel47 solved myself... 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now