0

How do I convert this MySQL query to Laravel Eloquent Query:

SELECT * FROM service_package WHERE price IN ('110010', 'Test 02', '11009')

1
  • Search docs for whereIn Commented Jun 26, 2019 at 12:32

1 Answer 1

2

You can use the whereIn() like:

  1. Using DB::table()
$data = \DB::table("service_package")
               ->whereIn("price", ['110010', 'Test 02', '11009'])
               ->get();
  1. Using Eloquent
$data = App\ServicePackage::whereIn("price", ['110010', 'Test 02', '11009'])
               ->get();

Here, make sure you have created model ServicePackage for the table service_package.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.