Commit 3ea0de9fd70d1e536ee0ea55f9879bf0d6ef7123

Authored by Андрей Ларионов
1 parent 6c589246f7

Коммит - новый работодатель - отправка емайла админу

Showing 3 changed files with 77 additions and 0 deletions Side-by-side Diff

app/Http/Controllers/EmployerController.php
... ... @@ -10,6 +10,8 @@ use App\Http\Requests\FlotRequest;
10 10 use App\Http\Requests\MessagesRequiest;
11 11 use App\Http\Requests\VacancyRequestEdit;
12 12 use App\Http\Requests\VacansiaRequiest;
  13 +use App\Mail\MailAdminy;
  14 +use App\Mail\MailCreateEmployer;
13 15 use App\Mail\MailSotrudnichestvo;
14 16 use App\Mail\SendAllMessages;
15 17 use App\Models\Ad_employer;
... ... @@ -475,6 +477,9 @@ class EmployerController extends Controller
475 477 } else {
476 478 $user = $this->create($params);
477 479 event(new Registered($user));
  480 +
  481 + Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params));
  482 +
478 483 Auth::guard()->login($user);
479 484 }
480 485  
app/Mail/MailCreateEmployer.php
... ... @@ -0,0 +1,66 @@
  1 +<?php
  2 +
  3 +namespace App\Mail;
  4 +
  5 +use Illuminate\Bus\Queueable;
  6 +use Illuminate\Contracts\Queue\ShouldQueue;
  7 +use Illuminate\Mail\Mailable;
  8 +use Illuminate\Mail\Mailables\Content;
  9 +use Illuminate\Mail\Mailables\Envelope;
  10 +use Illuminate\Queue\SerializesModels;
  11 +
  12 +class MailCreateEmployer extends Mailable
  13 +{
  14 + use Queueable, SerializesModels;
  15 +
  16 + protected $data;
  17 + /**
  18 + * Create a new message instance.
  19 + *
  20 + * @return void
  21 + */
  22 + public function __construct($data)
  23 + {
  24 + $this->data = $data;
  25 + }
  26 +
  27 + /**
  28 + * Get the message envelope.
  29 + *
  30 + * @return \Illuminate\Mail\Mailables\Envelope
  31 + */
  32 + public function envelope()
  33 + {
  34 + return new Envelope(
  35 + subject: 'Mail Create Employer',
  36 + );
  37 + }
  38 +
  39 + /**
  40 + * Get the message content definition.
  41 + *
  42 + * @return \Illuminate\Mail\Mailables\Content
  43 + */
  44 + public function content()
  45 + {
  46 + return new Content(
  47 + view: 'emails.create_emp',
  48 + );
  49 + }
  50 +
  51 + public function build()
  52 + {
  53 + // Вернуть все данные
  54 + return $this->view('emails.create_emp', ['data' => $this->data]);
  55 + }
  56 +
  57 + /**
  58 + * Get the attachments for the message.
  59 + *
  60 + * @return array
  61 + */
  62 + public function attachments()
  63 + {
  64 + return [];
  65 + }
  66 +}
resources/views/emails/create_emp.blade.php
... ... @@ -0,0 +1,6 @@
  1 +<div>
  2 + Зарегистрирован новый работодатель: {{ $data['surname']." ".$data['name_man']." ".$data['surname2'] }}<br>
  3 + Email: {{ $data['email'] }}<br>
  4 + Название компании: {{ $data['name_company'] }}<br>
  5 + Телефон: {{ $data['telephone'] }}<br>
  6 +</div>