Browse Source

fix transportation

jauhar54 2 years ago
parent
commit
97493a40c3
1 changed files with 24 additions and 1 deletions
  1. 24
    1
      app/Http/Controllers/Api/V1/TransportationController.php

+ 24
- 1
app/Http/Controllers/Api/V1/TransportationController.php View File

44
 
44
 
45
     public function getByUser($user_id)
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
         if($query){
72
         if($query){
50
             $result = $query;
73
             $result = $query;

Loading…
Cancel
Save