eloquent where like in laravel code example
Example 1: where like laravel
User::query()
->where('name', 'LIKE', "%{$searchTerm}%")
->orWhere('email', 'LIKE', "%{$searchTerm}%")
->get();
reference:
https://freek.dev/1182-searching-models-using-a-where-like-query-in-laravel
Example 2: laravel wherein like
$admin_permissions = Permission::all();
// Teacher Role
$teacher_permissions = $admin_permissions->filter(function ($permission) {
return substr($permission->title, 0, 8) == 'teacher_';
});