Closed garbinmarcelo closed 5 years ago
Hi Marcelo, I'm happy that it's been useful.
public function hashidToId($hashid)
{
return @Hashids::connection($this->getHashidsConnection())
->decode($hashid)[0];
}
The responsibility of this method is to decode a hashid belonging to the models of the class by using the connection (options) used for encoding the hashids of the model.
It's possible to use it, and it's used, on an empty model (new Model()
) - again by using the connection options of the model.
Perfect, that's what I would like to know. Thanks for your return. greetings
Hello, how are you? First I would like to thank you for the library. I was already using
vinkla/hashids
, but yours already helped to dry the code.But a question arose as to how the
$item->hashidToId($hashid);
method works, could you explain how to use it? Is it possible to use it without an instance of the model (as a helper)?Thank you
P.S.: I was confused because of this
$item->
I don't know where it is coming from or being instantiated. But I think it's from the model, right?