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