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
    – levi
    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.

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.