There is a request:
$req = Log::with([]); which gives this output:
"data": [ { "id": 2, "date": "1975-01-01 16:01:54", "ip": { "ip": "119.43.251.206", "country": "India", "code": "IN" }, "user": { "id": 2, "login": "user" }, "access": "user" }, ... For example, filter by ip
if (!empty($params['ip'])) { $req->where('ip', '=', $params['ip']); } works.
ip string field
Attributes in the Log Model
public function getIpAttribute($value) { $ip = geoip($value); return [ 'ip' => $ip->ip, 'country' => $ip->country, 'code' => $ip->iso_code, ]; } How to make a filter by iSO country code?