PaliBookCategoryController.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Http\Request;
  4. use Illuminate\Http\Response;
  5. class PaliBookCategoryController extends Controller
  6. {
  7. /**
  8. * Display a listing of the resource.
  9. *
  10. * @return Response
  11. */
  12. public function index()
  13. {
  14. //
  15. }
  16. /**
  17. * Store a newly created resource in storage.
  18. *
  19. * @return Response
  20. */
  21. public function store(Request $request)
  22. {
  23. //
  24. }
  25. /**
  26. * Display the specified resource.
  27. *
  28. * @param string $file
  29. * @return Response
  30. */
  31. public function show($file)
  32. {
  33. $data = file_get_contents(public_path("data/category/{$file}.json"));
  34. if ($data === false) {
  35. return $this->error('no file');
  36. }
  37. $response = json_decode($data);
  38. return response()->json(
  39. $response,
  40. 200,
  41. [
  42. 'Content-Type' => 'application/json;charset=UTF-8',
  43. 'Charset' => 'utf-8',
  44. ],
  45. JSON_UNESCAPED_UNICODE
  46. );
  47. }
  48. /**
  49. * Update the specified resource in storage.
  50. *
  51. * @param int $id
  52. * @return Response
  53. */
  54. public function update(Request $request, $id)
  55. {
  56. //
  57. }
  58. /**
  59. * Remove the specified resource from storage.
  60. *
  61. * @param int $id
  62. * @return Response
  63. */
  64. public function destroy($id)
  65. {
  66. //
  67. }
  68. }