Chron
130
5
Laravel

How to obfuscate ids?

Posted 1 month ago by Chron

How can I obfuscate ids from the user? But at the same time, I need the ids to run a logic

I have this in a form that grabs ids

//---------------Customer Blade
<select name="customer">
@foreach($customers as $c)
    <option value="{{ $c->id }}">{{ $c->name }}</option>
@endforeach
</select>


//---------------Customer Controller
$companies = Customer::whereIn('id',request('customer'))->get();

I want to use UUIDs but they are autogenerated every time.

Please sign in or create an account to participate in this conversation.