$oUserIncentives->get(0)->user_incentive->get(0)->{$sColName} should work.
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<><
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
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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community