Reputation: 2222
I cannot decrypt the encrypted value on a controller after clicking on the submit button on my blade file below.
Controller :
public function edit($id)
{
$encrypted_id = encrypt($id);
return view('my.blade.edit', compact('encrypted_id'));
}
public function update(Request $request, $id)
{
$decrypted_id = decrypt($id);
dd($decrypted_id);
}
Blade: (my.blade.edit)
{{ Form::open(['route' => ['route.update', $encrypted_id ], 'method' => 'PATCH']) }}
{{ Form::button('Update', ['type' => 'submit', 'name' => 'update']) }}
{{ Form::close() }}
I am expecting an integer value on my dd();
but I still getting an encrypted string.
Upvotes: 0
Views: 775
Reputation: 2398
Well, as I've already written in the comments, first and simple is to check expected output and exact output.
So far we discovered, that value was sent to view isn't equal to value received in update()
method.
id
was encrypted twice, but we don't see two encrypt()
calls in the code from the question. Probably some other code layer was making that.
Upvotes: 1