|
|
@@ -0,0 +1,75 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace App\Http\Controllers;
|
|
|
+
|
|
|
+use App\Models\Vocabulary;
|
|
|
+use Illuminate\Http\Request;
|
|
|
+use App\Http\Resources\VocabularyResource;
|
|
|
+
|
|
|
+class VocabularyController extends Controller
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * Display a listing of the resource.
|
|
|
+ *
|
|
|
+ * @return \Illuminate\Http\Response
|
|
|
+ */
|
|
|
+ public function index(Request $request)
|
|
|
+ {
|
|
|
+ //
|
|
|
+ switch ($request->get("view")) {
|
|
|
+ case 'key':
|
|
|
+ $result = Vocabulary::where('word_en','like',$request->get("key")."%")->take(20)->get();
|
|
|
+ if($result){
|
|
|
+ return $this->ok(['rows'=>VocabularyResource::collection($result),'count'=>count($result)]);
|
|
|
+ }else{
|
|
|
+ return $this->error();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Store a newly created resource in storage.
|
|
|
+ *
|
|
|
+ * @param \Illuminate\Http\Request $request
|
|
|
+ * @return \Illuminate\Http\Response
|
|
|
+ */
|
|
|
+ public function store(Request $request)
|
|
|
+ {
|
|
|
+ //
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Display the specified resource.
|
|
|
+ *
|
|
|
+ * @param \App\Models\Vocabulary $vocabulary
|
|
|
+ * @return \Illuminate\Http\Response
|
|
|
+ */
|
|
|
+ public function show(Vocabulary $vocabulary)
|
|
|
+ {
|
|
|
+ //
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Update the specified resource in storage.
|
|
|
+ *
|
|
|
+ * @param \Illuminate\Http\Request $request
|
|
|
+ * @param \App\Models\Vocabulary $vocabulary
|
|
|
+ * @return \Illuminate\Http\Response
|
|
|
+ */
|
|
|
+ public function update(Request $request, Vocabulary $vocabulary)
|
|
|
+ {
|
|
|
+ //
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Remove the specified resource from storage.
|
|
|
+ *
|
|
|
+ * @param \App\Models\Vocabulary $vocabulary
|
|
|
+ * @return \Illuminate\Http\Response
|
|
|
+ */
|
|
|
+ public function destroy(Vocabulary $vocabulary)
|
|
|
+ {
|
|
|
+ //
|
|
|
+ }
|
|
|
+}
|