The mistake is probably in that search query because of the orWhere statements.
Imagine that you've sent for example program with value reporthistory and search with value 'test right?
So your end result (query) will look something like:
$reportview->where('crewprogram_isdisabled', '=',1)
->where ( 'employee_nik', 'LIKE', "%{$request->search}%" )
->orWhere ( 'employee_nama', 'LIKE', "%{$request->search}%" )
->orWhere ( 'show_focus_id', 'LIKE', "%{$request->search}%" )
->orWhere ( 'show_name', 'LIKE', "%{$request->search}%" );
In SQL this will look like:
SELECT * FROM <table> WHERE crewprogram_isdisabled = 1 AND employee_nik LIKE '%test%' OR employee_nama LIKE '%test%' OR show_focus_id LIKE '%test%' OR show_name LIKE '%test%'
Because you have orWhere statements everything that fulfills those conditions will be returned no meter if the where conditions are met.
You should group the where statements.
if($request->has('search')){
$reportview->where(function($query) use ($request) {
$query->where ( 'employee_nik', 'LIKE', "%{$request->search}%" )
->orWhere ( 'employee_nama', 'LIKE', "%{$request->search}%" )
->orWhere ( 'show_focus_id', 'LIKE', "%{$request->search}%" )
->orWhere ( 'show_name', 'LIKE', "%{$request->search}%" );
});
}
So for example your SQL will look like:
SELECT * FROM <table> WHERE crewprogram_isdisabled = 1 AND (employee_nik LIKE '%test%' OR employee_nama LIKE '%test%' OR show_focus_id LIKE '%test%' OR show_name LIKE '%test%')