@@ -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 @@ |
||
| 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 | */ |
@@ -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 | */ |
@@ -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('admin.profile.edit', $doctor->id))->with('success', 'Foto profil berhasil dihapus !'); |
| 213 | 213 | } |
| 214 | 214 | return redirect(route('admin.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 | |
@@ -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 | * |
@@ -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,7 +62,7 @@ discard block |
||
| 62 | 62 | $doctor->email = $request->input('email'); |
| 63 | 63 | $doctor->password = Hash::make($request->password); |
| 64 | 64 | |
| 65 | - if($doctor->save()) { |
|
| 65 | + if ($doctor->save()) { |
|
| 66 | 66 | return redirect(route('doctor.index')); |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function update(Request $request, $id) |
| 106 | 106 | { |
| 107 | - $this->validate($request,[ |
|
| 107 | + $this->validate($request, [ |
|
| 108 | 108 | 'name' => 'required|min:3|max:50', |
| 109 | 109 | 'password' => 'required_with:password_confirmation|same:password_confirmation|min:6', |
| 110 | 110 | 'password_confirmation' => 'min:6' |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $doctor = Doctor::find($id); |
| 130 | 130 | $doctor->delete(); |
| 131 | 131 | |
| 132 | - return redirect (route('doctor.index')); |
|
| 132 | + return redirect(route('doctor.index')); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | 'role' => session('role'), |
| 48 | 48 | 'admin' => $admin, |
| 49 | 49 | ]; |
| 50 | - return view('pages.admin')->with('data',$data); |
|
| 50 | + return view('pages.admin')->with('data', $data); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $data = [ |
| 61 | 61 | 'role' => session('role') |
| 62 | 62 | ]; |
| 63 | - return view ('pages.ext.add-admin')->with('data',$data); |
|
| 63 | + return view('pages.ext.add-admin')->with('data', $data); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function store(Request $request) |
| 73 | 73 | { |
| 74 | - $this->validate($request,[ |
|
| 74 | + $this->validate($request, [ |
|
| 75 | 75 | 'name' => 'required|min:3|max:50', |
| 76 | 76 | 'email' => 'required|email', |
| 77 | 77 | 'password' => 'required_with:password_confirmation|same:password_confirmation|min:6', |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | $admin->email = $request->input('email'); |
| 84 | 84 | $admin->password = Hash::make($request->input('password')); |
| 85 | 85 | |
| 86 | - if($admin->save()) { |
|
| 87 | - return redirect (route('admin.index'))->with('success', 'Admin berhasil di tambahkan !'); |
|
| 86 | + if ($admin->save()) { |
|
| 87 | + return redirect(route('admin.index'))->with('success', 'Admin berhasil di tambahkan !'); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - return redirect (route('admin.index'))->with('failed', 'Gagal menambah admin !'); |
|
| 90 | + return redirect(route('admin.index'))->with('failed', 'Gagal menambah admin !'); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
@@ -145,9 +145,9 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $img = null; |
| 147 | 147 | |
| 148 | - if($request->hasFile('profile_picture')) { |
|
| 148 | + if ($request->hasFile('profile_picture')) { |
|
| 149 | 149 | |
| 150 | - if( $admin->profile_picture != "user-default.jpg") { |
|
| 150 | + if ($admin->profile_picture != "user-default.jpg") { |
|
| 151 | 151 | Storage::delete('public/user_images/'.$admin->profile_picture); |
| 152 | 152 | } |
| 153 | 153 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | $admin->name = $request->input('name'); |
| 167 | 167 | $admin->email = $request->input('email'); |
| 168 | - if($request->hasFile('profile_picture')) { |
|
| 168 | + if ($request->hasFile('profile_picture')) { |
|
| 169 | 169 | $admin->profile_picture = $img; |
| 170 | 170 | } |
| 171 | 171 | $admin->save(); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | public function editPass($id) |
| 185 | 185 | { |
| 186 | 186 | $admin = $this->currentUser(); |
| 187 | - if($admin->id == $id) { |
|
| 187 | + if ($admin->id == $id) { |
|
| 188 | 188 | $data = [ |
| 189 | 189 | 'admin' => $admin |
| 190 | 190 | ]; |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | public function updatePass(Request $request, $id) |
| 205 | 205 | { |
| 206 | 206 | $admin = $this->currentUser(); |
| 207 | - if($admin->id == $id) { |
|
| 207 | + if ($admin->id == $id) { |
|
| 208 | 208 | |
| 209 | 209 | $this->validate($request, [ |
| 210 | 210 | 'old_password' => 'required|min:6', |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | 'password_confirmation' => 'required|min:6' |
| 213 | 213 | ]); |
| 214 | 214 | |
| 215 | - if($this->validatePass($request->input('old_password'))) { |
|
| 215 | + if ($this->validatePass($request->input('old_password'))) { |
|
| 216 | 216 | $admin->password = Hash::make($request->input('new_password')); |
| 217 | 217 | $admin->save(); |
| 218 | 218 | |
@@ -232,12 +232,12 @@ discard block |
||
| 232 | 232 | public function removeImage() |
| 233 | 233 | { |
| 234 | 234 | $admin = $this->currentUser(); |
| 235 | - if($admin->profile_picture != "user-default.jpg") { |
|
| 235 | + if ($admin->profile_picture != "user-default.jpg") { |
|
| 236 | 236 | Storage::delete('public/user_images/'.$admin->profile_picture); |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | $admin->profile_picture = "user-default.jpg"; |
| 240 | - if($admin->save()) { |
|
| 240 | + if ($admin->save()) { |
|
| 241 | 241 | return redirect(route('admin.profile.edit', $admin->id))->with('success', 'Foto profil berhasil dihapus !'); |
| 242 | 242 | } |
| 243 | 243 | } |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | public function destroy() { |
| 250 | 250 | $admin = $this->currentUser(); |
| 251 | 251 | |
| 252 | - if($admin->delete()) { |
|
| 252 | + if ($admin->delete()) { |
|
| 253 | 253 | |
| 254 | 254 | session()->flush(); |
| 255 | 255 | return redirect(route('admin.login', $admin->id))->with('success', 'Akun berhasil dihapus !'); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | private function validatePass(string $oldPassword) |
| 276 | 276 | { |
| 277 | 277 | $admin = $this->currentUser(); |
| 278 | - if(Hash::check($oldPassword, $admin->password)) { |
|
| 278 | + if (Hash::check($oldPassword, $admin->password)) { |
|
| 279 | 279 | return true; |
| 280 | 280 | } |
| 281 | 281 | |