I have a question about the where command. I have this form element in my database table with a lot of columns and I need to search specific values: customers and type. As shown below...
<form action="{{ route(shop.find) }}">
<select class="form-control" name="customers1" id="customers1">
@foreach ($customers as $key => $value)
<option value="{{ $key }}">{{ $value }}</option>
@endforeach
</select>
<select class="form-control" name="type1" id="type1">
@foreach ($types as $key => $value)
<option value="{{ $key }}">{{ $value }}</option>
@endforeach
</select>
</form>
In my controller, I am stuck at the where command.
public function find(Request $request){
$customers = DB::table("tbl_customers")->pluck('name','id')->where('name', '=', $request->name);
//This where command is absolutely wrong. I need the right ways to do it.
$types = DB::table("tbl_types")->pluck('race','raceid')->where('race', '=', $request->race);
return view('shop.find',compact('customers', 'types'));}
I don't know what I need. Or what I need to use. I hope you guys can help.