LARAVEL 5.6 เราจะใส่เงื่อนไข AND code IN(?) ได้ยังไงบ้างคะ
ตอนนี้มันออกมาแค่ ค่าเดียว
Code (PHP)
<?php
namespace App\Http\Controllers\Report;
use DB;
use App\Http\Controllers\Controller;
class VisitTodayController extends Controller
{
/**
* Show a list of all of the application's users.
*
* @return Response
*/
public function VisitToday()
{
//$visitToday = DB:: table('DB_TEST.dbo.CONFIG ')->get();
//$visitToday = DB:: table('DB_TEST.dbo.CONFIG ')->find(10);//id only
//var_dump($visitToday);
//dd($visitToday);
$visitToday = DB::select('SELECT CtrlCode,Code,EngName,Name FROM DB_TEST.dbo.CONFIG
WHERE CtrlCode = 40103 AND code IN(?) ', ['AC','ADIO','ADM','AJ','AN','BNC','CATH','CCU', 'CD','CHK','CN','CONSULT','DEN','DON','ENT','ER','EYE','HC','HEMO','HOC','ICU','LAB', 'LR','LSK','MED','MED2','MGI','MHC','MS','NEURO','NUR','NUT','OPG','OV','OTH','PED','PHR','PT','SKIN','SMO','SUG','WME','WPD','WSG','XRAY']);
dd($visitToday);
return view('VisitToday', ['visitToday' => $visitToday]);
}
}