瀏覽代碼

fix transportation

jauhar54 2 年之前
父節點
當前提交
97493a40c3
共有 1 個檔案被更改,包括 24 行新增1 行删除
  1. 24
    1
      app/Http/Controllers/Api/V1/TransportationController.php

+ 24
- 1
app/Http/Controllers/Api/V1/TransportationController.php 查看文件

@@ -44,7 +44,30 @@ class TransportationController extends Controller
44 44
 
45 45
     public function getByUser($user_id)
46 46
     {
47
-        $query = Transportation::where('user_id', Helper::hash($user_id, 'decode'))->findOrFail();
47
+        $query = Transportation::where('user_id', Helper::hash($user_id, 'decode'))->get();
48
+
49
+        if($query){
50
+            $result = $query;
51
+
52
+            $res_status = true;
53
+            $msg = 'Mendapatkan Data';
54
+            $status_msg = $msg;
55
+
56
+            return $this->resSuccess(null, $res_status, $msg, $status_msg, $result);
57
+
58
+        }else {
59
+
60
+            $res_status = false;
61
+            $msg = 'Data tidak ditemukan';
62
+            $status_msg = $msg;
63
+
64
+            return $this->resSuccess(null, $res_status, $msg, $status_msg, null);
65
+        }
66
+    }
67
+
68
+    public function getSingle($data_id)
69
+    {
70
+        $query = Transportation::where('id', Helper::hash($data_id, 'decode'))->get();
48 71
 
49 72
         if($query){
50 73
             $result = $query;

Loading…
取消
儲存