From 3fb5818dbb6d321cfc9f9dbee5fbd30c7761cd93 Mon Sep 17 00:00:00 2001 From: Massimo Di Lullo Date: Sat, 19 Oct 2019 13:59:29 -0400 Subject: [PATCH] Correction Inscription --- .../Controllers/InscriptionController.php | 4 +++- app/Rules/PhoneRule.php | 2 +- app/User.php | 19 ------------------- resources/views/inscription.blade.php | 12 ++++++------ resources/views/mails/inscription.blade.php | 2 +- 5 files changed, 11 insertions(+), 28 deletions(-) diff --git a/app/Http/Controllers/InscriptionController.php b/app/Http/Controllers/InscriptionController.php index b7a982f..92f0041 100644 --- a/app/Http/Controllers/InscriptionController.php +++ b/app/Http/Controllers/InscriptionController.php @@ -39,6 +39,8 @@ class InscriptionController extends Controller $member = $this->create($request->all()); + (new MailController())->sendInscriptionMail($member); + return view('inscription')->with([ 'member' => $member ]); @@ -64,7 +66,7 @@ class InscriptionController extends Controller 'email' => $data['email'], 'universal_code' => $data['universal_code'], 'start_semester' => Member::getSemesterLetter().date("Y"), - 'activity' => Member::ACTIVITY[0], + 'activity' => 1, 'phone' => $data['phone'], 'program_id' => $data['program_id'] ]); diff --git a/app/Rules/PhoneRule.php b/app/Rules/PhoneRule.php index a198d64..e8a4783 100644 --- a/app/Rules/PhoneRule.php +++ b/app/Rules/PhoneRule.php @@ -26,7 +26,7 @@ class PhoneRule implements Rule public function passes($attribute, $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; } diff --git a/app/User.php b/app/User.php index 28cc144..d097dfe 100644 --- a/app/User.php +++ b/app/User.php @@ -36,27 +36,8 @@ class User extends Authenticatable 'email_verified_at' => 'datetime', ]; - protected $appends = [ - 'email', 'first_name', 'last_name' - ]; - public function 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; - } } diff --git a/resources/views/inscription.blade.php b/resources/views/inscription.blade.php index 58ccab3..447305c 100644 --- a/resources/views/inscription.blade.php +++ b/resources/views/inscription.blade.php @@ -90,14 +90,14 @@
- @foreach($programs as $program) - + @endforeach - @error('program') + @error('program_id') {{ $message }} @@ -109,14 +109,14 @@
- @foreach($communicationMethods as $communicationMethod) - + @endforeach - @error('communication_method') + @error('communication_method_id') {{ $message }} diff --git a/resources/views/mails/inscription.blade.php b/resources/views/mails/inscription.blade.php index 872129f..c523196 100644 --- a/resources/views/mails/inscription.blade.php +++ b/resources/views/mails/inscription.blade.php @@ -18,7 +18,7 @@ @endforeach

{{ __('mails.laboratory-deadline', ['deadline' => date("d-m-Y", strtotime("+3 weeks"))]) }}

-

{{ __('mails.laboratory-return-instruction') }}

+

{!! __('mails.laboratory-return-instruction') !!}