Support the ongoing development of Laravel.io →
Eloquent Views
Last updated 1 year ago.
0

$oUserIncentives->get(0)->user_incentive->get(0)->{$sColName} should work.

0

Yes, TY, mengidd. That works too! =)

I think this works too: $sColName = 'id_' . $iIndexPlusOne; $iCurBool = $oUserIncentives->get(0)->user_incentive->get(0)->$sColName;

I think one of the reasons the View form wasn't showing properly is because I was missing a parameter in the Form::checkbox. I was setting the boolean flag on the second parameter rather than the third parameter. This is the Form::checkbox that works. The second parameter is supposed to be the setting for the value. I didn't know. Took me awhile to figure it out.

{{ Form::checkbox( $sColName, $iCurBool, $bFlag, [ 'id' => $sColName, 'placeholder' => 'enter your first name' ] ) }} {{ $oGetAllIncentivesTable->get($index)->name }}:

Thank you, mengidd. That was a fast response. Blessings<><

0

just to nitpick a little, if you are creating field names such as id_1.. maybe you should convert them to arrays?

name all your fields like so: name="id[]" then you could loop through ID array.. instead of all that bloated code

0

Yeah, thanks. I see, shez1983. =) Yeah, I have some refactoring to do for sure. Code can always be cleaner. =)

Oh, btw, just for others if they catch this post, mengidd's suggestion for the curly braces is the best. Oddly, in the View blade template without using the curly braces seem to work as well as using the curly braces.

However, the curly braces are needed in the Model.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

vkimura vkimura Joined 5 Aug 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.