You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
1.6 KiB

  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Models\Framework;
  4. use Illuminate\Http\Request;
  5. use Illuminate\Http\JsonResponse;
  6. class FrameworkController extends Controller
  7. {
  8. /**
  9. * Display a listing of the resource.
  10. */
  11. public function index(): JsonResponse
  12. {
  13. $categories = Framework::all();
  14. return response()->json($categories);
  15. }
  16. /**
  17. * Show the form for creating a new resource.
  18. */
  19. public function create()
  20. {
  21. //
  22. }
  23. /**
  24. * Store a newly created resource in storage.
  25. */
  26. public function store(Request $request): JsonResponse
  27. {
  28. $request->validate([
  29. 'frameworkName' => 'required|string|max:255',
  30. 'version' => 'nullable|string',
  31. ]);
  32. $framework = Framework::create([
  33. 'framework_name' => $request->frameworkName,
  34. 'version' => $request->version,
  35. ]);
  36. return response()->json([
  37. 'message' => 'Application framework added!',
  38. 'framework' => $framework,
  39. ]);
  40. }
  41. /**
  42. * Display the specified resource.
  43. */
  44. public function show(Framework $framework)
  45. {
  46. //
  47. }
  48. /**
  49. * Show the form for editing the specified resource.
  50. */
  51. public function edit(Framework $framework)
  52. {
  53. //
  54. }
  55. /**
  56. * Update the specified resource in storage.
  57. */
  58. public function update(Request $request, Framework $framework)
  59. {
  60. //
  61. }
  62. /**
  63. * Remove the specified resource from storage.
  64. */
  65. public function destroy(Framework $framework)
  66. {
  67. //
  68. }
  69. }