PagesController.php 1.25 KB
<?php

namespace App\Http\Controllers;

use App\Models\pages;
use Illuminate\Http\Request;
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 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');
    }
}