@@ -4,8 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class City extends Model |
|
8 | -{ |
|
7 | +class City extends Model { |
|
9 | 8 | /** |
10 | 9 | * @var string |
11 | 10 | */ |
@@ -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 @@ |
||
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 | */ |
@@ -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 | * |
@@ -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 |