PagesController.php 1.07 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();
       print_r($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');
    }
}