{{-- --}}
@php
use Illuminate\Support\Facades\DB;
$DataSource = DB::table('tmstmmaterial');
if (isset($WhereType) && isset($WhereType2) && isset($ValueWhere) && isset($ValueWhere2) && isset($operator)) {
$DataSource->where($WhereType, $operator, $ValueWhere);
$DataSource->orWhere($WhereType2, $operator, $ValueWhere2);
}
$DataSource = $DataSource->get()->toArray();
if (isset($WithOption) && $WithOption == true) {
foreach ($DataSource as $item) {
$item->unit = DB::table('tmstmmat_unit')
->where('xvmatcode', '=', $item->xvmatcode)
->join('tmstmunit', 'tmstmmat_unit.xvuntcode', 'tmstmunit.xvuntcode')
->get()
->toArray();
}
}
$pk = 'xvmatcode';
$display = 'xvmatname';
@endphp