I am trying to query my database that is connected to my model "Address" to find any addresses that are 'LIKE' any input into my form in the address input field. My model code is:
public function CheckForPrevious($verify)
{
$matches = \App\Address::where('address', 'like', '%'.$verify.'%')
->get();
foreach($matches as $match)
{
echo "$match";
}
}
My controller code is:
public function show()
{
$address = new Address;
$check = $_POST['address'];
$address->CheckForPrevious($check);
return $address;
}
Any help would be greatly appreciated