Custom user fields #711 (#772)

Custom user fields during registration and profile edit #711
This commit is contained in:
Nabeel S
2020-08-11 17:48:51 -04:00
committed by GitHub
parent 3739cc8e91
commit 3ebf4f2924
36 changed files with 740 additions and 107 deletions

View File

@@ -85,6 +85,18 @@
<p class="text-danger">{{ $errors->first('password_confirmation') }}</p>
@endif
@if($userFields)
@foreach($userFields as $field)
<label for="field_{{ $field->slug }}" class="control-label">{{ $field->name }}</label>
<div class="input-group form-group-no-border {{ $errors->has('field_'.$field->slug) ? 'has-danger' : '' }}">
{{ Form::text('field_'.$field->slug, null, ['class' => 'form-control']) }}
</div>
@if ($errors->has('field_'.$field->slug))
<p class="text-danger">{{ $errors->first('field_'.$field->slug) }}</p>
@endif
@endforeach
@endif
@if(config('captcha.enabled'))
<label for="g-recaptcha-response" class="control-label">@lang('auth.fillcaptcha')</label>
<div

View File

@@ -16,6 +16,6 @@
{{ $field->value }}
@endif
</div>
<p class="text-danger">{{ $errors->first($field->slug) }}</p>
<p class="text-danger">{{ $errors->first('field_'.$field->slug) }}</p>
</td>
</tr>

View File

@@ -0,0 +1,16 @@
<tr>
<td>
{{ $field->field->name }}
@if($field->field->required === true)
<span class="text-danger">*</span>
@endif
</td>
<td>
<div class="input-group input-group-sm form-group">
{{ Form::text($field->field->slug, $field->value, [
'class' => 'form-control',
]) }}
</div>
<p class="text-danger">{{ $errors->first('field_'.$field->slug) }}</p>
</td>
</tr>

View File

@@ -108,6 +108,27 @@
@endif
</td>
</tr>
{{-- Custom fields --}}
@foreach($userFields as $field)
<tr>
<td>
{{ $field->name }}
@if($field->required === true)
<span class="text-danger">*</span>
@endif
</td>
<td>
<div class="input-group input-group-sm form-group">
{{ Form::text('field_'.$field->slug, $field->value, [
'class' => 'form-control',
]) }}
</div>
<p class="text-danger">{{ $errors->first('field_'.$field->slug) }}</p>
</td>
</tr>
@endforeach
<tr>
<td>@lang('profile.opt-in')</td>
<td>

View File

@@ -128,4 +128,20 @@
</div>
</div>
@endif
<div class="clearfix" style="height: 50px;"></div>
<div class="row">
<div class="col-sm-12">
<table class="table table-full-width">
@foreach($userFields as $field)
@if($field->public === true)
<tr>
<td>{{ $field->name }}</td>
<td>{{ $field->value }}</td>
</tr>
@endif
@endforeach
</table>
</div>
</div>
@endsection