Using Laravel-5's 'LIKE' Equivalent (Eloquent)
In Laravel 5, you can use the like operator to perform partial string matches on database columns. However, when using the orWhereLike method, it's important to carefully construct the query to ensure it produces the desired results.
To address the situation described in the question, where orWhereLike is not matching any results, you should:
BookingDates::where('email', Input::get('email')) ->orWhere('name', 'like', '%' . Input::get('name') . '%') ->get();
This modification ensures that the query searches for names containing the input value anywhere within the string.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3