Correction Inscription

This commit is contained in:
Massimo Di Lullo 2019-10-19 13:59:29 -04:00
parent 805846529d
commit 3fb5818dbb
5 changed files with 11 additions and 28 deletions

View File

@ -39,6 +39,8 @@ class InscriptionController extends Controller
$member = $this->create($request->all()); $member = $this->create($request->all());
(new MailController())->sendInscriptionMail($member);
return view('inscription')->with([ return view('inscription')->with([
'member' => $member 'member' => $member
]); ]);
@ -64,7 +66,7 @@ class InscriptionController extends Controller
'email' => $data['email'], 'email' => $data['email'],
'universal_code' => $data['universal_code'], 'universal_code' => $data['universal_code'],
'start_semester' => Member::getSemesterLetter().date("Y"), 'start_semester' => Member::getSemesterLetter().date("Y"),
'activity' => Member::ACTIVITY[0], 'activity' => 1,
'phone' => $data['phone'], 'phone' => $data['phone'],
'program_id' => $data['program_id'] 'program_id' => $data['program_id']
]); ]);

View File

@ -26,7 +26,7 @@ class PhoneRule implements Rule
public function passes($attribute, $value) public function passes($attribute, $value)
{ {
if(!empty($value)) if(!empty($value))
return preg_match('/^(?:(?:\(?(?:00|\+)([1-4]\d\d|[1-9]\d?)\)?)?[\-\.\ \\\/]?)?((?:\(?\d{1,}\)?[\-\.\ \\\/]?){0,})(?:[\-\.\ \\\/]?(?:#|ext\.?|extension|x)[\-\.\ \\\/]?(\d+))?$/i', $value) && strlen($value) >= 10; return preg_match('/(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?/i', $value) && strlen($value) >= 10;
return true; return true;
} }

View File

@ -36,27 +36,8 @@ class User extends Authenticatable
'email_verified_at' => 'datetime', 'email_verified_at' => 'datetime',
]; ];
protected $appends = [
'email', 'first_name', 'last_name'
];
public function member() public function member()
{ {
return $this->belongsTo("App\Models\Member"); return $this->belongsTo("App\Models\Member");
} }
public function getEmailAttribute()
{
return $this->member()->email;
}
public function getFirstNameAttribute()
{
return $this->member()->first_name;
}
public function getLastNameAttribute()
{
return $this->member()->last_name;
}
} }

View File

@ -90,14 +90,14 @@
<label for="program" class="col-md-4 col-form-label text-md-right">{{ __('general.program') }}</label> <label for="program" class="col-md-4 col-form-label text-md-right">{{ __('general.program') }}</label>
<div class="col-md-8"> <div class="col-md-8">
<select id="program" class="form-control @error('program') is-invalid @enderror" name="program" value="{{ old('program') }}" required autocomplete="program"> <select id="program_id" class="form-control @error('program_id') is-invalid @enderror" name="program_id" required autocomplete="program_id">
<option>{{ __('general.choose-option') }}</option> <option>{{ __('general.choose-option') }}</option>
@foreach($programs as $program) @foreach($programs as $program)
<option value="{{ $program->id }}">{{ $program->name }}</option> <option value="{{ $program->id }}" {{ old('program_id') == $program->id ? "selected" : "" }}>{{ $program->name }}</option>
@endforeach @endforeach
</select> </select>
@error('program') @error('program_id')
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
</span> </span>
@ -109,14 +109,14 @@
<label for="communication_method" class="col-md-4 col-form-label text-md-right">{{ __('general.communication-method') }}</label> <label for="communication_method" class="col-md-4 col-form-label text-md-right">{{ __('general.communication-method') }}</label>
<div class="col-md-8"> <div class="col-md-8">
<select id="communication_method" class="form-control @error('communication_method') is-invalid @enderror" name="communication_method" value="{{ old('communication_method') }}" required autocomplete="communication_method"> <select id="communication_method_id" class="form-control @error('communication_method_id') is-invalid @enderror" name="communication_method_id" required autocomplete="communication_method_id">
<option>{{ __('general.choose-option') }}</option> <option>{{ __('general.choose-option') }}</option>
@foreach($communicationMethods as $communicationMethod) @foreach($communicationMethods as $communicationMethod)
<option value="{{ $communicationMethod->id }}">{{ $communicationMethod->name }}</option> <option value="{{ $communicationMethod->id }}" {{ old('communication_method_id') == $communicationMethod->id ? "selected" : "" }}>{{ $communicationMethod->name }}</option>
@endforeach @endforeach
</select> </select>
@error('communication_method') @error('communication_method_id')
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong> <strong>{{ $message }}</strong>
</span> </span>

View File

@ -18,7 +18,7 @@
@endforeach @endforeach
</ul> </ul>
<p>{{ __('mails.laboratory-deadline', ['deadline' => date("d-m-Y", strtotime("+3 weeks"))]) }}</p> <p>{{ __('mails.laboratory-deadline', ['deadline' => date("d-m-Y", strtotime("+3 weeks"))]) }}</p>
<p>{{ __('mails.laboratory-return-instruction') }}</p> <p>{!! __('mails.laboratory-return-instruction') !!}</p>
</div> </div>
</div> </div>
</div> </div>