28 lines
544 B
PHP
28 lines
544 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class DataController extends Controller
|
|
{
|
|
|
|
|
|
public function show($filename)
|
|
{
|
|
|
|
$path = storage_path("app/json/en/{$filename}.json");
|
|
|
|
if (!Storage::disk('local')->exists("json/en/{$filename}.json")) {
|
|
return response()->json(['error' => 'File not found.'], 404);
|
|
}
|
|
|
|
$content = Storage::get("json/en/{$filename}.json");
|
|
$data = json_decode($content, true);
|
|
|
|
return response()->json($data);
|
|
}
|
|
|
|
}
|