0
I am developing an application in Laravel and at a certain moment I need to generate a value in MD5 to assign to a field in the database.
The problem is that when generating this hash of MD5, a "random number" is appearing and is entering the variable, instead of entering the variable the hash created. Behold:
if($this->emptyField === 0)
{
//Criando um id do lote
$fileId = md5(time() . rand(0, 9999) . time());
print_r($fileId);
}
See what is generated:
If you notice there, 4 numbers (9634) are generated along with the MD5 hash. When you enter the database, only these 4 numbers enter the column.
Sometimes it happens to only generate the MD5 hash even.
The field in the database is varchar(100). And the database is Mysql.
Could you help me ?
Follow the full code link if you want to consult.
https://paste.laravel.io/2d6d0c04-82db-476b-b1e6-b37b5f792e68
How the conversation went on was moved to the chat and you can continue there, if you are interested in reading and/or participating, you can click on the link. About the closure, as what was presented is expected behavior, nothing to be done in the scope of the site. In these cases, you need to provide a [mcve] of a real problem that does not depend on external links. In the absence of these possibilities, the question should not be asked on this site.
– Bacco