Support the ongoing development of Laravel.io →
posted 8 years ago
Blade
Last updated 2 years ago.
0

The third argument in the form builder's checkbox method is the checked attribute.

This

$user_profile->modules->where('module_id','=',$m->id)

returns a true value in each case thus you end up with all checkboxes being checked. Investigate the reason why that statement returns true value all the time.

My guess is that you have to append the whole query with a ->get() method. Then wrap the whole thing in a count(). Count will return 0 if no result has matched your query.

Die and dump this

$user_profile->modules->where('module_id','=',$m->id)

You should see that it outputs something other than a falsy value no matter of the database.

Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

sonesay sonesay Joined 1 Dec 2015

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.