Support the ongoing development of Laravel.io →
Input Eloquent Testing
Last updated 2 years ago.
0

Assuming you are using

Input::all()

Try changing it to

Input::except('password_confirmation')
Last updated 2 years ago.
0

Thank you for the response however it does not help me. I need to have there that confirmation because it is required by validation.

I don't want to be storing data in repo by setting every value. It is storing resource with

Model::create($data);

by design. It will be better from the maintenance point of view since then I will not be required to update it in changes of my schema.

The app itself is working fine but the test fails because of it.

Last updated 2 years ago.
0

This was you are vulnerable to mass assignment.

Assign the $fillable property and you will be safe and that will also solve this problem of yours.

Last updated 2 years ago.
0

Thanks for the response, but that is not the problem. I have $fillable property and it is working like it should be except during tests.

Last updated 2 years ago.
0

I had same issue. In my case it was caused by Eloquent::unguard() in database seeds. You need to call Eloquent::reguard() after seeding database.

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Joe5 joe5 Joined 26 Oct 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.