Laravel: how to query to get all records except where relation has name column = admin -


मेरे पास यह क्वेरी है

  $ users = user :: whereHas ('भूमिकाएं', फ़ंक्शन ($ q) {$ q- & gt; जहां ('नाम', '! =', 'व्यवस्थापक');}) - & gt; प्राप्त ();  

लेकिन मुझे उन सभी उपयोगकर्ताओं को शामिल करना है जिनके पास कोई भूमिका नहीं है I क्या यह पूछने का कोई तरीका है?

आप उन उपयोगकर्ताओं को प्राप्त करना चाहते हैं जहां 'व्यवस्थापक' से मेल खाने वाली भूमिकाओं की संख्या एक से कम है: < ('नाम', 'व्यवस्थापक');}, '& lt;', ($ 'क्यू)' ($ q) फ़ंक्शन ($ q) {$ q- & gt; 1) - & gt; मिल ();


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -