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