Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect requirements to blocks #125

Merged
merged 7 commits into from
Apr 30, 2020
Merged

Conversation

carlobeltrame
Copy link
Member

@carlobeltrame carlobeltrame commented Mar 10, 2020

Fixes #75
Also, refactors the FormRequests so that validation of one-to-many and many-to-many associations can be done directly in the FormRequests, and renames fields like requirement_ids to requirements etc. to still provide correct validation error messages.
Now, you can validate whether the related entites (that the user selects in a Multiselect dropdown) all exist in the course:

[
    'requirements' => 'required|regex:/^\d+(,\d+)*$/|allExistInCourse',
    'block' => 'required|regex:/^\d+$/|existsInCourse'`,
]

In order to get correct validation error messages, also name relation
fields after the model (e.g. requirements) instead of the ids (e.g.
requirement_ids).
Also adds the laravel-fillable-relations package and uses it to
automatically save the block on an observation.
…-fillable-relations

The laravel-fillable-relations package overwrote how the static
Model::create method works, and this broke with our current approach
for always setting the email of Hitobito users to verified. Fixed by
using a more standard approach for setting this (do it in the constructor
instead of the newInstance method)
@carlobeltrame carlobeltrame force-pushed the connect-requirements-to-blocks branch from 3270b18 to 5d1e5aa Compare March 17, 2020 13:26
@carlobeltrame carlobeltrame merged commit 7cff98c into master Apr 30, 2020
@carlobeltrame carlobeltrame deleted the connect-requirements-to-blocks branch April 30, 2020 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Beim Erstellen von Anforderungen direkt Blöcke zuweisen können
1 participant