I need to save Ip's in the database. I am using laravel but I need to store IPv6 and IPv4 ip's Is the ip type ready for IP?
$table->ipAddress('visitor');
Or do I need to use a the normal string type.
Thanks
I need to save Ip's in the database. I am using laravel but I need to store IPv6 and IPv4 ip's Is the ip type ready for IP?
$table->ipAddress('visitor');
Or do I need to use a the normal string type.
Thanks
The ipAddress()
method creates the following field types for the specified databases:
For text fields, the maximum length needed to store IPv6 addresses is 45 characters, so it looks like this is taken into account for MySql, SqlServer, and SqlLite. Additionally, the inet
field in Postgres handles both IPv4 and IPv6 fields.
Considering all this, I'd say it is safe to assume the ipAddress()
method will create a field that can handle IPv6 in any database.