2015-05-03 73 views
3

我有一個表格,其中包含用戶提交的鏈接。 某些鏈接不包含反向查詢like-laravel雄辯或原始MySQL查詢

`http://` 

我想通過使用下面的查詢列出這些記錄:

 $object = Related::whereHas(function($q) 
       { 
       $q->where('URL', 'like', 'http%'); 

        })->get(); 

如何扭轉查詢來獲取它們呢?

THX

回答

10

也許你可以在這種情況下使用not like操作:

$object = Related::whereHas(function($q) 
{ 
    $q->where('URL', 'not like', 'http%'); 

)->get(); 
+0

謝謝!有用。 – Peter