I have two tables; dashboard_map_items and device_data_current. in dashboard_map_items I have two field, id and command and in device_data_current I have three field id, commands, current_value. Based on the id and commands in my dashboard_map_items I need get the current_data from device_data_current.
Now I dont know where to start. Before I was able to hard-code the id and command and fetch the current_data from device_data_current but this is not working for me anymore, because the id and commands will be changed in the future.
$currentValues = DeviceDataCurrent::where('map_id', 1)
->where('system_id', $system_id)
->where('command', 1)->where('id', 64)
->orderby('datetime', 'DESC')->take(1)->get();
this is what i was doing to get the data. if it would help i am using laravel 4.2 framework but i dont know it has anything to do with laravel. it is pure php. Any help would be appreciated.