家政小程序
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.

OptionController.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Models\OptionValue;
  4. use Illuminate\Http\Request;
  5. use App\Models\OptionKey;
  6. class OptionController extends Controller
  7. {
  8. public function option_keys(Request $request,$classify_id) {
  9. $classify_id = $request->route("classify_id");
  10. if($classify_id) {
  11. $options = OptionKey::with("optionValues")->where("classify_id", $classify_id)->get()->toArray();
  12. return Response()->json([
  13. "status" => 0,
  14. "data" => $options
  15. ]);
  16. }
  17. }
  18. public function option_key(Request $request, $id) {
  19. $option_key_id = $request->route("id");
  20. if($option_key_id) {
  21. $option_value = OptionKey::with("optionValues")->find($option_key_id);
  22. return Response()->json([
  23. "status" => 0,
  24. "data" => $option_value
  25. ]);
  26. }
  27. }
  28. public function option_value(Request $request, $id) {
  29. $option_value_id = $request->route("id");
  30. if($option_value_id) {
  31. $option_value = OptionValue::with("optionKey")->find($option_value_id);
  32. return Response()->json([
  33. "status" => 0,
  34. "data" => $option_value
  35. ]);
  36. }
  37. }
  38. }