Support the ongoing development of Laravel.io →
Eloquent Validation Architecture

Hi,

I have model timesheetweek which has many (7) timesheetdays. On a view I can dynamicly add several weeks which each contain 7 inputs (1/day).

Is there an easy way to sync the input with the models?

So let's say the input would contain the amount of hours:

  • if hours == 0 : destroy the timesheetday
  • if hours are the same : don't update
  • if hours is different : update.

thanks

Last updated 3 years ago.
0

I could eventually use several foreach loops and use nested if's to get this working but if someone would be able to tell me how to synchronise models the professional way that would be great :)

What I have so far:

  • each week has a data-attribute start week (which gives the dat of monday)
  • each child form control input (mon to sun) has their date set in a data-attribute
  • as weeks can be added dynamicly I can't really use id's to check the sync(array(id1, id2, ... idn) method
Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

goowikns goowikns Joined 18 Jun 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.

© 2025 Laravel.io - All rights reserved.