2017-03-15 51 views

回答

0

我相信like轉化反正正則表達式,所以你可以做它作爲not regexp

$user = Comment::where('body', 'not regexp', '/spam/i'))->get(); 
+0

我試圖實現我的情況是這樣的:'評論::在哪裏(「DELETED_BY」,「不是正則表達式','/'。auth() - > user() - > id。'/ i') - > get();'。它不起作用 –

+0

應該是這樣的:'Comment :: where('deleted_by','not regexp','/.*'.auth()->user()->id.'/i')->get ();' –

+0

首先,「它不工作」不是問題陳述(c)。其次,'/ 18/i'和'/.* 18/i'沒有區別。你有任何錯誤,或只是沒有得到預期的結果? –