@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function cutStr($str) |
53 | 53 | { |
54 | - if (strlen($str) > 200){ |
|
55 | - return substr($str,0,200) . "..."; |
|
54 | + if (strlen($str) > 200) { |
|
55 | + return substr($str, 0, 200)."..."; |
|
56 | 56 | } |
57 | 57 | return $str; |
58 | 58 | } |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function trimStr($str) |
65 | 65 | { |
66 | - if(strlen($str) > 20) { |
|
67 | - return substr($str, 0, 20) . "..."; |
|
66 | + if (strlen($str) > 20) { |
|
67 | + return substr($str, 0, 20)."..."; |
|
68 | 68 | } |
69 | 69 | return $str; |
70 | 70 | } |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | public function getCat($str) |
77 | 77 | { |
78 | 78 | switch ($str) { |
79 | - case "penyakit": return "Penyakit"; break; |
|
79 | + case "penyakit": return "Penyakit"; break; |
|
80 | 80 | case "obat": return "Obat - obatan"; break; |
81 | - case "hidup-sehat": return "Hidup Sehat"; break; |
|
82 | - case "keluarga": return "Keluarga"; break; |
|
83 | - case "kesehatan": return "Kesehatan"; break; |
|
81 | + case "hidup-sehat": return "Hidup Sehat"; break; |
|
82 | + case "keluarga": return "Keluarga"; break; |
|
83 | + case "kesehatan": return "Kesehatan"; break; |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | */ |
52 | 52 | public function trimStr(string $str) |
53 | 53 | { |
54 | - if(strlen($str) > 50) { |
|
54 | + if (strlen($str) > 50) { |
|
55 | 55 | return substr($str, '0', '50')."..."; |
56 | 56 | } |
57 | 57 | return $str; |
@@ -78,7 +78,7 @@ |
||
78 | 78 | */ |
79 | 79 | public function trimStr($str) |
80 | 80 | { |
81 | - if(strlen($str) > 20) { |
|
81 | + if (strlen($str) > 20) { |
|
82 | 82 | return substr($str, 0, 20)."..."; |
83 | 83 | } |
84 | 84 | return $str; |
@@ -32,7 +32,7 @@ |
||
32 | 32 | /** |
33 | 33 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
34 | 34 | */ |
35 | - public function hospital(){ |
|
35 | + public function hospital() { |
|
36 | 36 | return $this->hasMany('App\Hospital'); |
37 | 37 | } |
38 | 38 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | * @return string |
35 | 35 | */ |
36 | 36 | public function trimStr($str) { |
37 | - if(strlen($str) > 15) { |
|
37 | + if (strlen($str) > 15) { |
|
38 | 38 | return substr($str, 0, 15)."..."; |
39 | 39 | } |
40 | 40 | return $str; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
34 | 34 | */ |
35 | 35 | public function city() { |
36 | - return $this->belongsTo('App\City','city_id'); |
|
36 | + return $this->belongsTo('App\City', 'city_id'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @return string |
42 | 42 | */ |
43 | 43 | public function trimStr($str) { |
44 | - if(strlen($str) > 10) { |
|
44 | + if (strlen($str) > 10) { |
|
45 | 45 | return substr($str, 0, 10)."..."; |
46 | 46 | } |
47 | 47 | return $str; |
@@ -14,10 +14,10 @@ |
||
14 | 14 | */ |
15 | 15 | protected function redirectTo($request) |
16 | 16 | { |
17 | - if (! $request->expectsJson()) { |
|
18 | - if($request->is('admin') || $request->is('admin/*')) { |
|
17 | + if (!$request->expectsJson()) { |
|
18 | + if ($request->is('admin') || $request->is('admin/*')) { |
|
19 | 19 | return route('admin.login'); |
20 | - } else if($request->is('doctor') || $request->is('doctor/*')) { |
|
20 | + } else if ($request->is('doctor') || $request->is('doctor/*')) { |
|
21 | 21 | return route('doctor.login'); |
22 | 22 | } else { |
23 | 23 | return route('login'); |
@@ -30,7 +30,7 @@ |
||
30 | 30 | break; |
31 | 31 | default: |
32 | 32 | if (Auth::guard($guard)->check()) { |
33 | - return redirect()->route('home'); |
|
33 | + return redirect()->route('home'); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 |
@@ -17,14 +17,14 @@ |
||
17 | 17 | */ |
18 | 18 | public function handle($request, Closure $next, $guard = null) |
19 | 19 | { |
20 | - switch($guard) { |
|
20 | + switch ($guard) { |
|
21 | 21 | case 'admin': |
22 | - if(Auth::guard($guard)->check()) { |
|
22 | + if (Auth::guard($guard)->check()) { |
|
23 | 23 | return redirect()->route('admin.index'); |
24 | 24 | } |
25 | 25 | break; |
26 | 26 | case 'doctor': |
27 | - if(Auth::guard($guard)->check()) { |
|
27 | + if (Auth::guard($guard)->check()) { |
|
28 | 28 | return redirect()->route('admin.index'); |
29 | 29 | } |
30 | 30 | break; |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | 'updated_at' => Carbon::now() |
48 | 48 | )); |
49 | 49 | |
50 | - if($room_id != null && $hospital_id != null) { |
|
50 | + if ($room_id != null && $hospital_id != null) { |
|
51 | 51 | $data = [ |
52 | 52 | 'hospital_id' => $hospital_id, |
53 | 53 | 'room_id' => $room_id |
54 | 54 | ]; |
55 | 55 | |
56 | - if($this->insertRoomDetails($data) && $this->updateHospitalUpdatedAt($hospital_id)) { |
|
56 | + if ($this->insertRoomDetails($data) && $this->updateHospitalUpdatedAt($hospital_id)) { |
|
57 | 57 | return redirect(route('hospital.show', $hospital_id)); |
58 | 58 | } |
59 | 59 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $hospital = $this->updateHospitalUpdatedAt($request->input('hospital_id')); |
114 | 114 | |
115 | - if($room->save() && $hospital == true) { |
|
115 | + if ($room->save() && $hospital == true) { |
|
116 | 116 | return redirect(route('hospital.show', $request->input('hospital_id'))); |
117 | 117 | } |
118 | 118 | } |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | $hospital = $this->updateHospitalUpdatedAt($hospital_id); |
131 | 131 | $detail = $this->deleteRoomDetails($room_id, $hospital_id); |
132 | 132 | |
133 | - if($room && $hospital && $detail) { |
|
134 | - return redirect(route('hospital.show', ['id' => $hospital_id])); |
|
133 | + if ($room && $hospital && $detail) { |
|
134 | + return redirect(route('hospital.show', [ 'id' => $hospital_id ])); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | { |
144 | 144 | $insert = DB::table('room_details') |
145 | 145 | ->insert([ |
146 | - 'room_id' => $data['room_id'], |
|
147 | - 'hospital_id' => $data['hospital_id'] |
|
146 | + 'room_id' => $data[ 'room_id' ], |
|
147 | + 'hospital_id' => $data[ 'hospital_id' ] |
|
148 | 148 | ]); |
149 | 149 | |
150 | - if($insert) { |
|
150 | + if ($insert) { |
|
151 | 151 | return true; |
152 | 152 | } |
153 | 153 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | ->where('hospital_id', '=', $hospital_id) |
167 | 167 | ->delete(); |
168 | 168 | |
169 | - if($delete) { |
|
169 | + if ($delete) { |
|
170 | 170 | return true; |
171 | 171 | } |
172 | 172 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | { |
182 | 182 | $hospital = Hospital::find($id); |
183 | 183 | $hospital->updated_at = Carbon::now(); |
184 | - if($hospital->save()) { |
|
184 | + if ($hospital->save()) { |
|
185 | 185 | return true; |
186 | 186 | } |
187 | 187 |