Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save toonvandenbos/bdde311a47be8e973a1ef1fa269843e1 to your computer and use it in GitHub Desktop.
Save toonvandenbos/bdde311a47be8e973a1ef1fa269843e1 to your computer and use it in GitHub Desktop.
Examples used in Medium Post "Making Laravel Nova custom fields more developer-friendly"
<?php
protected function fillAttributeFromRequest(NovaRequest $request, $requestAttribute, $model, $attribute)
{
if ($request->exists($requestAttribute)) {
$value = $this->handleIncomingRequestValue($request[$requestAttribute]);
// Now we're storing a verified or manipulated value
$model->{$attribute} = $value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment