How might I find something that is not like a certain string.
SELECT * FROM users WHERE username NOT LIKE '%ray%';
Simply you can use the model to get that result
User::where('username', 'not like', "%ray%")->get();
There are a few different options depending on your needs. You can use any of the following to find something that is not like a certain string:
Users::where('username', 'not like', "%ray%")->get();
DB::table('users')->where('username', 'not like', '%ray%');
Capsule::table('users')->select('*')->where('username', 'not like', '%ray%')->get();
Use DB facade
$data = DB::table('users')->select('*')->where('username', 'not like', '%ray%')->get();
Also you can use
$data = User::where('username', 'not like', "%ray%")->get();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With