Loop through a JSON Array in Laravel and return smaller list
£10-20 GBP
In Progress
Posted about 6 years ago
£10-20 GBP
Paid on delivery
I have an array which I recieve over a post method: {
"connected_macs":[
"22:33:44:55:66:71",
"22:33:44:55:66:72",
"22:33:44:55:66:73",
"22:33:44:55:66:74",
"22:33:44:55:66:75"
]
}
}
I need to loop through this list in Laravel, lookup each value in my database:
.... something similar to this., but don't worry to much about this logic as I can handle this...
$ct = Conn::where('mac', 'mac1')->first();
if($ct->expired == 1){
//take out the mac address from the array
}else{
//leave the mac in the array
}
then I want to return a response with only the macs I want to keep in the list in this format:
{
"deauth_macs":[
"22:33:44:55:66:71",
"22:33:44:55:66:72"
]
}