@@ -9,8 +9,7 @@ discard block |
||
9 | 9 | use App\Admin; |
10 | 10 | use Illuminate\Support\Facades\Storage; |
11 | 11 | |
12 | -class AdminController extends Controller |
|
13 | -{ |
|
12 | +class AdminController extends Controller { |
|
14 | 13 | /** |
15 | 14 | * AdminController constructor. |
16 | 15 | */ |
@@ -243,7 +242,8 @@ discard block |
||
243 | 242 | /** |
244 | 243 | * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector |
245 | 244 | */ |
246 | - public function destroy() { |
|
245 | + public function destroy() |
|
246 | + { |
|
247 | 247 | $admin = $this->currentUser(); |
248 | 248 | |
249 | 249 | if($admin->delete()) { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'role' => session('role'), |
55 | 55 | 'admin' => $admin, |
56 | 56 | ]; |
57 | - return view('pages.admin')->with('data',$data); |
|
57 | + return view('pages.admin')->with('data', $data); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $data = [ |
68 | 68 | 'role' => session('role') |
69 | 69 | ]; |
70 | - return view ('pages.ext.add-admin')->with('data',$data); |
|
70 | + return view('pages.ext.add-admin')->with('data', $data); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function store(Request $request) |
80 | 80 | { |
81 | - $this->validate($request,[ |
|
81 | + $this->validate($request, [ |
|
82 | 82 | 'name' => 'required|min:3|max:50', |
83 | 83 | 'email' => 'required|email', |
84 | 84 | 'password' => 'required_with:password_confirmation|same:password_confirmation|min:6', |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | $admin->email = $request->input('email'); |
91 | 91 | $admin->password = Hash::make($request->input('password')); |
92 | 92 | |
93 | - if($admin->save()) { |
|
94 | - return redirect (route('admin.index'))->with('success', 'Admin berhasil di tambahkan !'); |
|
93 | + if ($admin->save()) { |
|
94 | + return redirect(route('admin.index'))->with('success', 'Admin berhasil di tambahkan !'); |
|
95 | 95 | } |
96 | 96 | |
97 | - return redirect (route('admin.index'))->with('failed', 'Gagal menambah admin !'); |
|
97 | + return redirect(route('admin.index'))->with('failed', 'Gagal menambah admin !'); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | |
153 | 153 | $img = null; |
154 | 154 | |
155 | - if($request->hasFile('profile_picture')) { |
|
155 | + if ($request->hasFile('profile_picture')) { |
|
156 | 156 | |
157 | - if( $admin->profile_picture != "user-default.jpg") { |
|
157 | + if ($admin->profile_picture != "user-default.jpg") { |
|
158 | 158 | Storage::delete('public/user_images/'.$admin->profile_picture); |
159 | 159 | } |
160 | 160 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | $admin->name = $request->input('name'); |
174 | 174 | $admin->email = $request->input('email'); |
175 | - if($request->hasFile('profile_picture')) { |
|
175 | + if ($request->hasFile('profile_picture')) { |
|
176 | 176 | $admin->profile_picture = $img; |
177 | 177 | } |
178 | 178 | $admin->save(); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | public function editPass($id) |
192 | 192 | { |
193 | 193 | $admin = $this->currentUser(); |
194 | - if($admin->id == $id) { |
|
194 | + if ($admin->id == $id) { |
|
195 | 195 | $data = [ |
196 | 196 | 'admin' => $admin |
197 | 197 | ]; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | public function updatePass(Request $request, $id) |
212 | 212 | { |
213 | 213 | $admin = $this->currentUser(); |
214 | - if($admin->id == $id) { |
|
214 | + if ($admin->id == $id) { |
|
215 | 215 | |
216 | 216 | $this->validate($request, [ |
217 | 217 | 'old_password' => 'required|min:6', |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | 'password_confirmation' => 'required|min:6' |
220 | 220 | ]); |
221 | 221 | |
222 | - if($this->validatePass($request->input('old_password'))) { |
|
222 | + if ($this->validatePass($request->input('old_password'))) { |
|
223 | 223 | $admin->password = Hash::make($request->input('new_password')); |
224 | 224 | $admin->save(); |
225 | 225 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | public function log($id) |
236 | 236 | { |
237 | 237 | $admin = $this->currentUser(); |
238 | - if($admin->id == $id) { |
|
238 | + if ($admin->id == $id) { |
|
239 | 239 | $data = [ |
240 | 240 | 'admin' => $admin, |
241 | 241 | 'logs' => Log::orderBy('created_at', 'desc')->paginate(10) |
@@ -253,12 +253,12 @@ discard block |
||
253 | 253 | public function removeImage() |
254 | 254 | { |
255 | 255 | $admin = $this->currentUser(); |
256 | - if($admin->profile_picture != "user-default.jpg") { |
|
256 | + if ($admin->profile_picture != "user-default.jpg") { |
|
257 | 257 | Storage::delete('public/user_images/'.$admin->profile_picture); |
258 | 258 | } |
259 | 259 | |
260 | 260 | $admin->profile_picture = "user-default.jpg"; |
261 | - if($admin->save()) { |
|
261 | + if ($admin->save()) { |
|
262 | 262 | return redirect(route('admin.profile.edit', $admin->id))->with('success', 'Foto profil berhasil dihapus !'); |
263 | 263 | } |
264 | 264 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | public function destroy() { |
271 | 271 | $admin = $this->currentUser(); |
272 | 272 | |
273 | - if($admin->delete()) { |
|
273 | + if ($admin->delete()) { |
|
274 | 274 | |
275 | 275 | session()->flush(); |
276 | 276 | return redirect(route('admin.login', $admin->id))->with('success', 'Akun berhasil dihapus !'); |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | private function validatePass(string $oldPassword) |
297 | 297 | { |
298 | 298 | $admin = $this->currentUser(); |
299 | - if(Hash::check($oldPassword, $admin->password)) { |
|
299 | + if (Hash::check($oldPassword, $admin->password)) { |
|
300 | 300 | return true; |
301 | 301 | } |
302 | 302 |
@@ -8,8 +8,7 @@ |
||
8 | 8 | use App\Hospital; |
9 | 9 | use App\Room; |
10 | 10 | |
11 | -class RoomController extends Controller |
|
12 | -{ |
|
11 | +class RoomController extends Controller { |
|
13 | 12 | /** |
14 | 13 | * Show the form for creating a new resource. |
15 | 14 | * |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | 'updated_at' => Carbon::now() |
49 | 49 | )); |
50 | 50 | |
51 | - if($room_id != null && $hospital_id != null) { |
|
51 | + if ($room_id != null && $hospital_id != null) { |
|
52 | 52 | $data = [ |
53 | 53 | 'hospital_id' => $hospital_id, |
54 | 54 | 'room_id' => $room_id |
55 | 55 | ]; |
56 | 56 | |
57 | - if($this->insertRoomDetails($data) && $this->updateHospitalUpdatedAt($hospital_id)) { |
|
57 | + if ($this->insertRoomDetails($data) && $this->updateHospitalUpdatedAt($hospital_id)) { |
|
58 | 58 | return redirect(route('hospital.show', $hospital_id))->with('success', 'Kamar baru berhasil ditambahkan !'); |
59 | 59 | } |
60 | 60 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | $hospital = $this->updateHospitalUpdatedAt($request->input('hospital_id')); |
116 | 116 | |
117 | - if($room->save() && $hospital == true) { |
|
117 | + if ($room->save() && $hospital == true) { |
|
118 | 118 | return redirect(route('hospital.show', $request->input('hospital_id')))->with('success', 'Detil Kamar berhasil diubah !'); |
119 | 119 | } |
120 | 120 | } |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | $hospital = $this->updateHospitalUpdatedAt($hospital_id); |
133 | 133 | $detail = $this->deleteRoomDetails($room_id, $hospital_id); |
134 | 134 | |
135 | - if($room && $hospital && $detail) { |
|
136 | - return redirect(route('hospital.show', ['id' => $hospital_id]))->with('success', 'Kamar dihapus !'); |
|
135 | + if ($room && $hospital && $detail) { |
|
136 | + return redirect(route('hospital.show', [ 'id' => $hospital_id ]))->with('success', 'Kamar dihapus !'); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | { |
146 | 146 | $insert = DB::table('room_details') |
147 | 147 | ->insert([ |
148 | - 'room_id' => $data['room_id'], |
|
149 | - 'hospital_id' => $data['hospital_id'] |
|
148 | + 'room_id' => $data[ 'room_id' ], |
|
149 | + 'hospital_id' => $data[ 'hospital_id' ] |
|
150 | 150 | ]); |
151 | 151 | |
152 | - if($insert) { |
|
152 | + if ($insert) { |
|
153 | 153 | return true; |
154 | 154 | } |
155 | 155 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | ->where('hospital_id', '=', $hospital_id) |
169 | 169 | ->delete(); |
170 | 170 | |
171 | - if($delete) { |
|
171 | + if ($delete) { |
|
172 | 172 | return true; |
173 | 173 | } |
174 | 174 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | { |
184 | 184 | $hospital = Hospital::find($id); |
185 | 185 | $hospital->updated_at = Carbon::now(); |
186 | - if($hospital->save()) { |
|
186 | + if ($hospital->save()) { |
|
187 | 187 | return true; |
188 | 188 | } |
189 | 189 |
@@ -4,8 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Foundation\Http\Kernel as HttpKernel; |
6 | 6 | |
7 | -class Kernel extends HttpKernel |
|
8 | -{ |
|
7 | +class Kernel extends HttpKernel { |
|
9 | 8 | /** |
10 | 9 | * The application's global HTTP middleware stack. |
11 | 10 | * |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | $adminId = $this->getAttributeValue('admin_id'); |
39 | 39 | $doctorId = $this->getAttributeValue('doctor_id'); |
40 | 40 | |
41 | - $writer = ['role', 'data']; |
|
41 | + $writer = [ 'role', 'data' ]; |
|
42 | 42 | |
43 | - if($adminId != null) { |
|
44 | - $writer['role'] = "Admin"; |
|
45 | - $writer['data'] = Admin::find($adminId); |
|
46 | - } elseif($doctorId != null) { |
|
47 | - $writer['role'] = "Dokter"; |
|
48 | - $writer['data'] = Doctor::find($doctorId); |
|
43 | + if ($adminId != null) { |
|
44 | + $writer[ 'role' ] = "Admin"; |
|
45 | + $writer[ 'data' ] = Admin::find($adminId); |
|
46 | + } elseif ($doctorId != null) { |
|
47 | + $writer[ 'role' ] = "Dokter"; |
|
48 | + $writer[ 'data' ] = Doctor::find($doctorId); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $writer; |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function cutStr($str) |
59 | 59 | { |
60 | - if (strlen($str) > 200){ |
|
61 | - return substr($str,0,200) . "..."; |
|
60 | + if (strlen($str) > 200) { |
|
61 | + return substr($str, 0, 200)."..."; |
|
62 | 62 | } |
63 | 63 | return $str; |
64 | 64 | } |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | public function getCat($str) |
71 | 71 | { |
72 | 72 | switch ($str) { |
73 | - case "penyakit": return "Penyakit"; break; |
|
73 | + case "penyakit": return "Penyakit"; break; |
|
74 | 74 | case "obat": return "Obat - obatan"; break; |
75 | - case "hidup-sehat": return "Hidup Sehat"; break; |
|
76 | - case "keluarga": return "Keluarga"; break; |
|
77 | - case "kesehatan": return "Kesehatan"; break; |
|
75 | + case "hidup-sehat": return "Hidup Sehat"; break; |
|
76 | + case "keluarga": return "Keluarga"; break; |
|
77 | + case "kesehatan": return "Kesehatan"; break; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | } |
@@ -5,8 +5,7 @@ discard block |
||
5 | 5 | use App\Doctor; |
6 | 6 | use Illuminate\Database\Eloquent\Model; |
7 | 7 | |
8 | -class Articles extends Model |
|
9 | -{ |
|
8 | +class Articles extends Model { |
|
10 | 9 | /** |
11 | 10 | * @var string |
12 | 11 | */ |
@@ -33,7 +32,8 @@ discard block |
||
33 | 32 | /** |
34 | 33 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
35 | 34 | */ |
36 | - public function admin() { |
|
35 | + public function admin() |
|
36 | + { |
|
37 | 37 | return $this->belongsTo('App\Admin'); |
38 | 38 | } |
39 | 39 | |
@@ -41,7 +41,8 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
43 | 43 | */ |
44 | - public function doctor() { |
|
44 | + public function doctor() |
|
45 | + { |
|
45 | 46 | return $this->belongsTo('App\Doctor'); |
46 | 47 | } |
47 | 48 | |
@@ -49,7 +50,8 @@ discard block |
||
49 | 50 | * @param $id |
50 | 51 | * @return array |
51 | 52 | */ |
52 | - public function writer() { |
|
53 | + public function writer() |
|
54 | + { |
|
53 | 55 | $adminId = $this->getAttributeValue('admin_id'); |
54 | 56 | $doctorId = $this->getAttributeValue('doctor_id'); |
55 | 57 | |
@@ -72,7 +74,7 @@ discard block |
||
72 | 74 | */ |
73 | 75 | public function cutStr($str) |
74 | 76 | { |
75 | - if (strlen($str) > 200){ |
|
77 | + if (strlen($str) > 200) { |
|
76 | 78 | return substr($str,0,200) . "..."; |
77 | 79 | } |
78 | 80 | return $str; |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | public function trimStr($str) |
37 | 37 | { |
38 | - if(strlen($str) > 15) { |
|
38 | + if (strlen($str) > 15) { |
|
39 | 39 | return substr($str, 0, 15)."..."; |
40 | 40 | } |
41 | 41 | return $str; |
@@ -4,8 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class DoctorSpecialization extends Model |
|
8 | -{ |
|
7 | +class DoctorSpecialization extends Model { |
|
9 | 8 | /** |
10 | 9 | * @var string |
11 | 10 | */ |
@@ -29,7 +28,8 @@ discard block |
||
29 | 28 | 'updated_at' |
30 | 29 | ]; |
31 | 30 | |
32 | - public function doctor() { |
|
31 | + public function doctor() |
|
32 | + { |
|
33 | 33 | return $this->hasOne('App\Doctor', 'specialization_id'); |
34 | 34 | } |
35 | 35 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function city() |
36 | 36 | { |
37 | - return $this->belongsTo('App\City','city_id'); |
|
37 | + return $this->belongsTo('App\City', 'city_id'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function trimStr($str) |
45 | 45 | { |
46 | - if(strlen($str) > 10) { |
|
46 | + if (strlen($str) > 10) { |
|
47 | 47 | return substr($str, 0, 10)."..."; |
48 | 48 | } |
49 | 49 | return $str; |
@@ -4,8 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Hospital extends Model |
|
8 | -{ |
|
7 | +class Hospital extends Model { |
|
9 | 8 | /** |
10 | 9 | * @var string |
11 | 10 | */ |
@@ -40,7 +39,8 @@ discard block |
||
40 | 39 | /** |
41 | 40 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
42 | 41 | */ |
43 | - public function doctor() { |
|
42 | + public function doctor() |
|
43 | + { |
|
44 | 44 | return $this->belongsToMany('App\Doctor', 'doctor_details', 'hospital_id', 'doctor_id'); |
45 | 45 | } |
46 | 46 |
@@ -4,8 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class DoctorDetail extends Model |
|
8 | -{ |
|
7 | +class DoctorDetail extends Model { |
|
9 | 8 | /** |
10 | 9 | * @var string |
11 | 10 | */ |
@@ -10,8 +10,7 @@ |
||
10 | 10 | use Illuminate\Support\Facades\Hash; |
11 | 11 | use Illuminate\Support\Facades\Storage; |
12 | 12 | |
13 | -class DocController extends Controller |
|
14 | -{ |
|
13 | +class DocController extends Controller { |
|
15 | 14 | /** |
16 | 15 | * Create a new controller instance |
17 | 16 | * |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | |
49 | 49 | ]; |
50 | 50 | |
51 | - if( $doctor->city_id == null || |
|
51 | + if ($doctor->city_id == null || |
|
52 | 52 | $doctor->gender == null || |
53 | 53 | $doctor->biography == null || |
54 | 54 | $doctor->profile_picture == 'user-default.jpg') { |
55 | 55 | |
56 | - $data['warning'] = 'Sepertinya anda belum melengkapi data diri anda, segera lengkapi data diri anda.'; |
|
56 | + $data[ 'warning' ] = 'Sepertinya anda belum melengkapi data diri anda, segera lengkapi data diri anda.'; |
|
57 | 57 | } |
58 | 58 | return view('pages.dashboard')->with('data', $data); |
59 | 59 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | public function profile($id) |
68 | 68 | { |
69 | 69 | $doctor = $this->currentUser(); |
70 | - if($doctor->id == $id) { |
|
70 | + if ($doctor->id == $id) { |
|
71 | 71 | $data = [ |
72 | 72 | 'doctor' => $doctor |
73 | 73 | ]; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | public function edit($id) |
87 | 87 | { |
88 | 88 | $doctor = $this->currentUser(); |
89 | - if($doctor->id == $id) { |
|
89 | + if ($doctor->id == $id) { |
|
90 | 90 | $specialization = DoctorSpecialization::pluck('name', 'id'); |
91 | 91 | $cities = City::pluck('name', 'id'); |
92 | 92 | |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | $doctor = $this->currentUser(); |
125 | 125 | $img = null; |
126 | 126 | |
127 | - if($request->hasFile('profile_picture')) { |
|
127 | + if ($request->hasFile('profile_picture')) { |
|
128 | 128 | |
129 | - if( $doctor->profile_picture != "user-default.jpg") { |
|
129 | + if ($doctor->profile_picture != "user-default.jpg") { |
|
130 | 130 | Storage::delete('public/user_images/'.$doctor->profile_picture); |
131 | 131 | } |
132 | 132 | |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | $doctor->gender = $request->input('gender'); |
149 | 149 | $doctor->specialization_id = $request->input('specialization_id'); |
150 | 150 | $doctor->biography = $request->input('biography'); |
151 | - if($request->hasFile('profile_picture')) { |
|
151 | + if ($request->hasFile('profile_picture')) { |
|
152 | 152 | $doctor->profile_picture = $img; |
153 | 153 | } |
154 | 154 | |
155 | - if($doctor->save()) { |
|
155 | + if ($doctor->save()) { |
|
156 | 156 | return redirect(route('doctor.profile', $doctor->id))->with('success', 'Profil berhasil diperbarui !'); |
157 | 157 | } |
158 | 158 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | public function editPass($id) |
169 | 169 | { |
170 | 170 | $doctor = $this->currentUser(); |
171 | - if($doctor->id == $id) { |
|
171 | + if ($doctor->id == $id) { |
|
172 | 172 | $data = [ |
173 | 173 | 'doctor' => $doctor |
174 | 174 | ]; |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | public function updatePass(Request $request, $id) |
190 | 190 | { |
191 | 191 | $doctor = $this->currentUser(); |
192 | - if($this->validatePass($request->input('old_password'))) { |
|
193 | - if($request->input('old_password') == $request->input('new_password')) { |
|
192 | + if ($this->validatePass($request->input('old_password'))) { |
|
193 | + if ($request->input('old_password') == $request->input('new_password')) { |
|
194 | 194 | return redirect(route('doctor.password.edit', $doctor->id))->with('warning', 'Password baru tidak boleh sama dengan Password lama.'); |
195 | 195 | } |
196 | 196 | |
@@ -216,12 +216,12 @@ discard block |
||
216 | 216 | public function removeImage() |
217 | 217 | { |
218 | 218 | $doctor = $this->currentUser(); |
219 | - if($doctor->profile_picture != "user-default.jpg") { |
|
219 | + if ($doctor->profile_picture != "user-default.jpg") { |
|
220 | 220 | Storage::delete('public/user_images/'.$doctor->profile_picture); |
221 | 221 | } |
222 | 222 | |
223 | 223 | $doctor->profile_picture = "user-default.jpg"; |
224 | - if($doctor->save()) { |
|
224 | + if ($doctor->save()) { |
|
225 | 225 | return redirect(route('doctor.profile.edit', $doctor->id))->with('success', 'Foto profil berhasil dihapus !'); |
226 | 226 | } |
227 | 227 | return redirect(route('doctor.profile.edit', $doctor->id))->with('failed', 'Gagal menghapus foto profil.'); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | public function destroy() |
236 | 236 | { |
237 | 237 | $doctor = $this->currentUser(); |
238 | - if($doctor->delete()) { |
|
238 | + if ($doctor->delete()) { |
|
239 | 239 | session()->flush(); |
240 | 240 | return redirect(route('doctor.login'))->with('success', 'Akun telah dihapus !'); |
241 | 241 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | public function hospital($id) |
252 | 252 | { |
253 | 253 | $doctor = $this->currentUser(); |
254 | - if($doctor->id == $id) { |
|
254 | + if ($doctor->id == $id) { |
|
255 | 255 | $data = [ |
256 | 256 | 'doctor' => $doctor, |
257 | 257 | 'hospitals' => Hospital::where('city_id', $doctor->city_id)->paginate(5), |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $dd->doctor_id = $this->currentUser()->id; |
274 | 274 | $dd->hospital_id = $request->input('hospital_id'); |
275 | 275 | |
276 | - if($dd->save()) { |
|
276 | + if ($dd->save()) { |
|
277 | 277 | return redirect(route('doctor.profile.hospital', $this->currentUser()->id))->with('success', 'Rumah Sakit baru ditambahkan !'); |
278 | 278 | } |
279 | 279 | return redirect(route('doctor.profile.hospital', $this->currentUser()->id))->with('failed', 'Gagal menambah Rumah Sakit.'); |
@@ -281,13 +281,13 @@ discard block |
||
281 | 281 | |
282 | 282 | public function unregHospital($doctorId, $hospitalId) |
283 | 283 | { |
284 | - if($this->currentUser()->id != $doctorId) { |
|
284 | + if ($this->currentUser()->id != $doctorId) { |
|
285 | 285 | return redirect()->back()->with('warning', 'Anda tidak berhak mengakses laman tersebut.'); |
286 | 286 | } |
287 | 287 | $dd = DoctorDetail::where('doctor_id', $this->currentUser()->id) |
288 | 288 | ->where('hospital_id', $hospitalId); |
289 | - if($dd != null) { |
|
290 | - if($dd->delete()) { |
|
289 | + if ($dd != null) { |
|
290 | + if ($dd->delete()) { |
|
291 | 291 | return redirect(route('doctor.profile.hospital', $this->currentUser()->id))->with('success', 'Rumah Sakit dihapus !'); |
292 | 292 | } |
293 | 293 | return redirect(route('doctor.profile.hospital', $this->currentUser()->id))->with('failed', 'Gagal menghapus Rumah Sakit, Data tidak ditemukan.'); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | private function validatePass(string $oldPassword) |
315 | 315 | { |
316 | 316 | $doctor = $this->currentUser(); |
317 | - if(Hash::check($oldPassword, $doctor->password)) { |
|
317 | + if (Hash::check($oldPassword, $doctor->password)) { |
|
318 | 318 | return true; |
319 | 319 | } |
320 | 320 |
@@ -6,8 +6,7 @@ |
||
6 | 6 | use App\City; |
7 | 7 | use App\DoctorSpecialization; |
8 | 8 | |
9 | -class SpecializationController extends Controller |
|
10 | -{ |
|
9 | +class SpecializationController extends Controller { |
|
11 | 10 | /** |
12 | 11 | * Display a listing of the resource. |
13 | 12 | * |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | $specialty->name = $request->input('name'); |
53 | 53 | $specialty->detail = $request->input('detail'); |
54 | 54 | |
55 | - if($specialty->save()) { |
|
56 | - return redirect (route('specialty.index'))->with('success', 'Spesialisasi telah di tambahkan'); |
|
55 | + if ($specialty->save()) { |
|
56 | + return redirect(route('specialty.index'))->with('success', 'Spesialisasi telah di tambahkan'); |
|
57 | 57 | } |
58 | 58 | |
59 | - return redirect (route('specialty.index'))->with('failed', 'Gagal menambah spesialisasi !'); |
|
59 | + return redirect(route('specialty.index'))->with('failed', 'Gagal menambah spesialisasi !'); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | $specialty->name = $request->input('name'); |
105 | 105 | $specialty->detail = $request->input('detail'); |
106 | 106 | |
107 | - if($specialty->save()) { |
|
108 | - return redirect (route('specialty.index'))->with('success', 'Spesialisasi telah di update'); |
|
107 | + if ($specialty->save()) { |
|
108 | + return redirect(route('specialty.index'))->with('success', 'Spesialisasi telah di update'); |
|
109 | 109 | } |
110 | 110 | |
111 | - return redirect (route('specialty.edit', $id))->with('failed', 'Gagal memperbaharui spesialisasi !'); |
|
111 | + return redirect(route('specialty.edit', $id))->with('failed', 'Gagal memperbaharui spesialisasi !'); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | public function destroy($id) |
121 | 121 | { |
122 | 122 | $specialty = DoctorSpecialization::find($id); |
123 | - if($specialty->delete()) { |
|
123 | + if ($specialty->delete()) { |
|
124 | 124 | return redirect(route('specialty.index')); |
125 | 125 | } |
126 | 126 | } |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | |
138 | 138 | public function indexSearch() |
139 | 139 | { |
140 | - $specialization = DoctorSpecialization::orderBy('created_at','desc')->orderBy('name', 'asc')->take(6)->get(); |
|
141 | - $location = City::orderBy('name','asc')->pluck('name','id'); |
|
140 | + $specialization = DoctorSpecialization::orderBy('created_at', 'desc')->orderBy('name', 'asc')->take(6)->get(); |
|
141 | + $location = City::orderBy('name', 'asc')->pluck('name', 'id'); |
|
142 | 142 | $data = [ |
143 | 143 | 'specialization' => $specialization, |
144 | 144 | 'location' => $location |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | |
150 | 150 | public function searchSpecialty(Request $request) |
151 | 151 | { |
152 | - $specialization = DoctorSpecialization::where('name','LIKE','%'.$request->specialty.'%')->orderBy('name','asc')->get(); |
|
152 | + $specialization = DoctorSpecialization::where('name', 'LIKE', '%'.$request->specialty.'%')->orderBy('name', 'asc')->get(); |
|
153 | 153 | $data = [ |
154 | 154 | 'specialization' => $specialization |
155 | 155 | ]; |
156 | 156 | |
157 | - return view('LSdoctor')->with('data',$data); |
|
157 | + return view('LSdoctor')->with('data', $data); |
|
158 | 158 | } |
159 | 159 | } |