@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | 'warning' => null |
42 | 42 | ]; |
43 | 43 | |
44 | - if( $doctor->city_id == null || |
|
44 | + if ($doctor->city_id == null || |
|
45 | 45 | $doctor->gender == null || |
46 | 46 | $doctor->biography == null || |
47 | 47 | $doctor->profile_picture == 'user-default.jpg') { |
48 | 48 | |
49 | - $data['warning'] = 'Sepertinya anda belum melengkapi data diri anda, segera lengkapi data diri anda.'; |
|
49 | + $data[ 'warning' ] = 'Sepertinya anda belum melengkapi data diri anda, segera lengkapi data diri anda.'; |
|
50 | 50 | } |
51 | 51 | return view('pages.dashboard')->with('data', $data); |
52 | 52 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function profile($id) |
61 | 61 | { |
62 | 62 | $doctor = $this->currentUser(); |
63 | - if($doctor->id == $id) { |
|
63 | + if ($doctor->id == $id) { |
|
64 | 64 | $data = [ |
65 | 65 | 'doctor' => $doctor |
66 | 66 | ]; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function edit($id) |
80 | 80 | { |
81 | 81 | $doctor = $this->currentUser(); |
82 | - if($doctor->id == $id) { |
|
82 | + if ($doctor->id == $id) { |
|
83 | 83 | $specialization = DoctorSpecialization::pluck('name', 'id'); |
84 | 84 | $cities = City::pluck('name', 'id'); |
85 | 85 | |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | $doctor = $this->currentUser(); |
116 | 116 | $img = null; |
117 | 117 | |
118 | - if($request->hasFile('profile_picture')) { |
|
118 | + if ($request->hasFile('profile_picture')) { |
|
119 | 119 | |
120 | - if( $doctor->profile_picture != "user-default.jpg") { |
|
120 | + if ($doctor->profile_picture != "user-default.jpg") { |
|
121 | 121 | Storage::delete('public/user_images/'.$doctor->profile_picture); |
122 | 122 | } |
123 | 123 | |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | $doctor->gender = $request->input('gender'); |
140 | 140 | $doctor->specialization_id = $request->input('specialization_id'); |
141 | 141 | $doctor->biography = $request->input('biography'); |
142 | - if($request->hasFile('profile_picture')) { |
|
142 | + if ($request->hasFile('profile_picture')) { |
|
143 | 143 | $doctor->profile_picture = $img; |
144 | 144 | } |
145 | 145 | |
146 | - if($doctor->save()) { |
|
146 | + if ($doctor->save()) { |
|
147 | 147 | return redirect(route('doctor.profile', $doctor->id))->with('success', 'Profil berhasil diperbarui !'); |
148 | 148 | } |
149 | 149 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | public function editPass($id) |
160 | 160 | { |
161 | 161 | $doctor = $this->currentUser(); |
162 | - if($doctor->id == $id) { |
|
162 | + if ($doctor->id == $id) { |
|
163 | 163 | $data = [ |
164 | 164 | 'doctor' => $doctor |
165 | 165 | ]; |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | public function updatePass(Request $request, $id) |
179 | 179 | { |
180 | 180 | $doctor = $this->currentUser(); |
181 | - if($this->validatePass($request->input('old_password'))) { |
|
182 | - if($request->input('old_password') == $request->input('new_password')) { |
|
181 | + if ($this->validatePass($request->input('old_password'))) { |
|
182 | + if ($request->input('old_password') == $request->input('new_password')) { |
|
183 | 183 | return redirect(route('doctor.password.edit', $doctor->id))->with('warning', 'Password baru tidak boleh sama dengan Password lama.'); |
184 | 184 | } |
185 | 185 | |
@@ -203,12 +203,12 @@ discard block |
||
203 | 203 | public function removeImage() |
204 | 204 | { |
205 | 205 | $doctor = $this->currentUser(); |
206 | - if($doctor->profile_picture != "user-default.jpg") { |
|
206 | + if ($doctor->profile_picture != "user-default.jpg") { |
|
207 | 207 | Storage::delete('public/user_images/'.$doctor->profile_picture); |
208 | 208 | } |
209 | 209 | |
210 | 210 | $doctor->profile_picture = "user-default.jpg"; |
211 | - if($doctor->save()) { |
|
211 | + if ($doctor->save()) { |
|
212 | 212 | return redirect(route('doctor.profile.edit', $doctor->id))->with('success', 'Foto profil berhasil dihapus !'); |
213 | 213 | } |
214 | 214 | return redirect(route('doctor.profile.edit', $doctor->id))->with('failed', 'Gagal menghapus foto profil.'); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | public function destroy() |
219 | 219 | { |
220 | 220 | $doctor = $this->currentUser(); |
221 | - if($doctor->delete()) { |
|
221 | + if ($doctor->delete()) { |
|
222 | 222 | session()->flush(); |
223 | 223 | return redirect(route('doctor.login'))->with('success', 'Akun telah dihapus !'); |
224 | 224 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | private function validatePass(string $oldPassword) |
243 | 243 | { |
244 | 244 | $doctor = $this->currentUser(); |
245 | - if(Hash::check($oldPassword, $doctor->password)) { |
|
245 | + if (Hash::check($oldPassword, $doctor->password)) { |
|
246 | 246 | return true; |
247 | 247 | } |
248 | 248 |
@@ -17,12 +17,12 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function index() |
19 | 19 | { |
20 | - $doctor = Doctor::orderBy('name','asc')->paginate(10); |
|
20 | + $doctor = Doctor::orderBy('name', 'asc')->paginate(10); |
|
21 | 21 | $data = [ |
22 | 22 | 'role' => session('role'), |
23 | 23 | 'doctor' => $doctor, |
24 | 24 | ]; |
25 | - return view('pages.doctor')->with('data',$data); |
|
25 | + return view('pages.doctor')->with('data', $data); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function store(Request $request) |
47 | 47 | { |
48 | - $this->validate($request,[ |
|
48 | + $this->validate($request, [ |
|
49 | 49 | 'specialty' => 'required', |
50 | 50 | 'name' => 'required|min:3|max:50', |
51 | 51 | 'license' => 'required|min:3|max:191', |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | $doctor->email = $request->input('email'); |
63 | 63 | $doctor->password = Hash::make($request->password); |
64 | 64 | |
65 | - if($doctor->save()) { |
|
66 | - return redirect (route('doctor.index'))->with('success', 'Berhasil Menambahkan Dokter !'); |
|
65 | + if ($doctor->save()) { |
|
66 | + return redirect(route('doctor.index'))->with('success', 'Berhasil Menambahkan Dokter !'); |
|
67 | 67 | } |
68 | 68 | |
69 | - return redirect (route('doctor.index'))->with('failed', 'Gagal menambah dokter !'); |
|
69 | + return redirect(route('doctor.index'))->with('failed', 'Gagal menambah dokter !'); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function update(Request $request, $id) |
108 | 108 | { |
109 | - $this->validate($request,[ |
|
109 | + $this->validate($request, [ |
|
110 | 110 | 'name' => 'required|min:3|max:50', |
111 | 111 | 'password' => 'required_with:password_confirmation|same:password_confirmation|min:6', |
112 | 112 | 'password_confirmation' => 'min:6' |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | $doctor = Doctor::find($id); |
117 | 117 | $doctor->name = $request->input('name'); |
118 | 118 | $doctor->password = $pass; |
119 | - if($doctor->save()) { |
|
120 | - return redirect (route('admin.index'))->with('success', 'Doctor berhasil di update !'); |
|
119 | + if ($doctor->save()) { |
|
120 | + return redirect(route('admin.index'))->with('success', 'Doctor berhasil di update !'); |
|
121 | 121 | } |
122 | 122 | |
123 | - return redirect (route('admin.edit', $id))->with('failed', 'Gagal memperbaharui dokter !'); |
|
123 | + return redirect(route('admin.edit', $id))->with('failed', 'Gagal memperbaharui dokter !'); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $doctor = Doctor::find($id); |
135 | 135 | $doctor->delete(); |
136 | 136 | |
137 | - return redirect (route('doctor.index')); |
|
137 | + return redirect(route('doctor.index')); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | } |