38 lines
967 B
PHP
38 lines
967 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
class MatrixController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
$matrix82File = storage_path('app/public/matrix_82.csv');
|
|
$matrix73File = storage_path('app/public/matrix_73.csv');
|
|
$matrix91File = storage_path('app/public/matrix_91.csv');
|
|
|
|
$matrix82 = $this->readCsv($matrix82File);
|
|
$matrix73 = $this->readCsv($matrix73File);
|
|
$matrix91 = $this->readCsv($matrix91File);
|
|
|
|
return view('matrix', [
|
|
'matrix82' => $matrix82,
|
|
'matrix73' => $matrix73,
|
|
'matrix91' => $matrix91,
|
|
]);
|
|
}
|
|
|
|
private function readCsv($file)
|
|
{
|
|
$rows = [];
|
|
if (($handle = fopen($file, 'r')) !== false) {
|
|
while (($data = fgetcsv($handle, 1000, ',')) !== false) {
|
|
$rows[] = $data;
|
|
}
|
|
fclose($handle);
|
|
}
|
|
return $rows;
|
|
}
|
|
}
|