Skip to content

Instantly share code, notes, and snippets.

@ohnotnow
ohnotnow / gist:ef81d8b4c9c7787a2eaa3450e7d8a126
Last active August 10, 2016 11:51
Versioning forms/models
For instance, say I have an 'annual review' form for people. Last year
they had to fill out training courses attended, this year they don't.
Next year the form changes completely but is still called an 'annual
review' as far as the business is concerned. The forms can change
pretty much any time - not just on a nice annual cycle (naturally).
There are also process/logic changes like one year a review has to be
signed off by the line manager. Next year it has to be also signed off
by their unit head. The year after there is an arbitration process
introduced so if the person appeals the decision of $whoever was supposed
@ohnotnow
ohnotnow / controller_snippet.php
Created June 7, 2016 16:08
Trying to build an array for laravel sync() method using a collection pipeline
/**
The allocate_ids and remove_ids are from a multiselect so just an array of id's.
Trying to end up with a structure like :
[
123 => ['is_accepted' => true],
345 => ['is_accepted' => true],
...
]
No matter how many variations of map/flatmap/values/blah I used I always either ended up
with a collection of collections, or had re-keyed the collection to something like :