家政小程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

HomePageController.php 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Models\HomePage;
  4. use Illuminate\Http\Request;
  5. class HomePageController extends Controller
  6. {
  7. public function store(Request $request) {
  8. $introduce = $request->input("introduce");
  9. if($introduce) {
  10. $homePage = HomePage::find(1);
  11. if($homePage) {
  12. $homePage->introduce = $introduce;
  13. $homePage->save();
  14. return Response()->json([
  15. "status" => 0,
  16. "message" => "修改成功"
  17. ]);
  18. } else {
  19. return Response()->json([
  20. "status" => -1,
  21. "message" => "记录不存在"
  22. ]);
  23. }
  24. } else {
  25. return Response()->json([
  26. "status" => -1,
  27. "message" => "introduce不能为空!"
  28. ]);
  29. }
  30. }
  31. public function introduce(Request $request) {
  32. $homePage = HomePage::find(1);
  33. return Response()->json([
  34. "status" => 0,
  35. "data" => [
  36. "introduce" => $homePage->introduce
  37. ]
  38. ]);
  39. }
  40. }