Commit 24b5f80e870acbccbdc288bf69c042b7dc2ad0c8

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

Результат отправки почты

Showing 1 changed file with 1 additions and 3 deletions Inline Diff

app/Http/Controllers/PagesController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers; 3 namespace App\Http\Controllers;
4 4
5 use App\Http\Requests\RequestSendAdmin; 5 use App\Http\Requests\RequestSendAdmin;
6 use App\Mail\MailAdminy; 6 use App\Mail\MailAdminy;
7 use App\Mail\MailRepair; 7 use App\Mail\MailRepair;
8 use App\Models\pages; 8 use App\Models\pages;
9 use Illuminate\Http\Request; 9 use Illuminate\Http\Request;
10 use Illuminate\Support\Facades\Mail; 10 use Illuminate\Support\Facades\Mail;
11 use Illuminate\Support\Facades\Redis; 11 use Illuminate\Support\Facades\Redis;
12 use PhpOffice\PhpSpreadsheet\Spreadsheet; 12 use PhpOffice\PhpSpreadsheet\Spreadsheet;
13 use PhpOffice\PhpSpreadsheet\Writer\Xlsx; 13 use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
14 14
15 class PagesController extends Controller 15 class PagesController extends Controller
16 { 16 {
17 public function pages(pages $pages) { 17 public function pages(pages $pages) {
18 $page = pages::query()->where('slug', $pages->slug)->first(); 18 $page = pages::query()->where('slug', $pages->slug)->first();
19 19
20 return view('pages', compact('page')); 20 return view('pages', compact('page'));
21 } 21 }
22 22
23 public function form_feedback(RequestSendAdmin $request){ 23 public function form_feedback(RequestSendAdmin $request){
24 $all = $request->all(); 24 $all = $request->all();
25 25
26 foreach ([$request->get('email')] as $recipient) { 26 Mail::to(env('EMAIL_ADMIN'))->send(new MailAdminy($all));
27 Mail::to($recipient)->send(new MailAdminy($all));
28 }
29 27
30 return redirect()->back()->with('Сообщение было успешно отправлено и будет обработано'); 28 return redirect()->back()->with('Сообщение было успешно отправлено и будет обработано');
31 } 29 }
32 30
33 public function redis() { 31 public function redis() {
34 $redis = Redis::connection(); 32 $redis = Redis::connection();
35 $redis->set('User:CompanyName', 'РЕКАМОРЕ'); 33 $redis->set('User:CompanyName', 'РЕКАМОРЕ');
36 $id = 1; 34 $id = 1;
37 //dd(Redis::get('MyVar')); 35 //dd(Redis::get('MyVar'));
38 $redis->command('rpush', array("Сообщение1")); 36 $redis->command('rpush', array("Сообщение1"));
39 $redis->command('rpush', array("Сообщение2")); 37 $redis->command('rpush', array("Сообщение2"));
40 $values = $redis->command('lrange', array("mylist", 0, 1)); 38 $values = $redis->command('lrange', array("mylist", 0, 1));
41 dd($values); 39 dd($values);
42 40
43 } 41 }
44 42
45 public function excel() { 43 public function excel() {
46 $spreadsheet = new Spreadsheet(); 44 $spreadsheet = new Spreadsheet();
47 $activeWorksheet = $spreadsheet->getActiveSheet(); 45 $activeWorksheet = $spreadsheet->getActiveSheet();
48 $activeWorksheet->setCellValue('A1', 'Hello World !'); 46 $activeWorksheet->setCellValue('A1', 'Hello World !');
49 47
50 $writer = new Xlsx($spreadsheet); 48 $writer = new Xlsx($spreadsheet);
51 $writer->save('hello_world.xlsx'); 49 $writer->save('hello_world.xlsx');
52 } 50 }
53 51
54 public function private_policy() { 52 public function private_policy() {
55 return view('private_policy'); 53 return view('private_policy');
56 } 54 }
57 55
58 public function terms_of_use() { 56 public function terms_of_use() {
59 return view('terms_of_use'); 57 return view('terms_of_use');
60 } 58 }
61 } 59 }
62 60