Skip to content

Commit

Permalink
add blob option for form builder (#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesj2 committed Mar 20, 2024
1 parent 1762bd0 commit af75382
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion resources/views/functional/form-builder.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
:restore-on-success="$form->getOption('restore_on_success')"

:preserve-scroll="$form->getOption('preserve_scroll')"

:blob="$form->getOption('blob')"
>
@foreach($form->getFields() as $field)
{!! $field->render() !!}
@endforeach

{{ $slot ?? '' }}
</x-splade-form>
</x-splade-form>
14 changes: 14 additions & 0 deletions src/SpladeForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,18 @@ public function validate(?Request $request = null, ...$params): array

return $request->validate($this->getRules(), ...$params);
}

/**
* Handle server response as a blob to allow downloading files.
*
* @param bool $blob
* @return $this
*/
public function blob(bool $blob = true): self
{
$this->options['blob'] = $blob;

return $this;
}

}

0 comments on commit af75382

Please sign in to comment.