I have a table where I am showing all the data. Now I want to make a filter to show specific data. I want to execute this query "SELECT * FROM internal_visitors
WHERE isSignIn = 1" in Laravel. But I didn't get any data.
Controller
public function index(Request $request){
$hosts = App\Host::all();
if($request->method('post') && $request->isSignIn!=""){
$isSignIn = $request->isSignIn;
$internalVisitors = InternalVisitor::where('isSignIn', '=', 1)->get();
dd(internalVisitors);
}
else{
$internalVisitors = InternalVisitor::all();
}
return view('admin\internalVisitor', compact('hosts','internalVisitors'));
}
view:
<form action="" method="POST">
@csrf
<li>
<button name="isSignIn" type="submit">is</button>
</li>
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire