@@ -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 |
@@ -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::pluck('name','id'); |
|
140 | + $specialization = DoctorSpecialization::orderBy('created_at', 'desc')->orderBy('name', 'asc')->take(6)->get(); |
|
141 | + $location = City::pluck('name', 'id'); |
|
142 | 142 | $data = [ |
143 | 143 | 'specialization' => $specialization, |
144 | 144 | 'location' => $location |
@@ -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 | * |
@@ -135,9 +135,9 @@ |
||
135 | 135 | |
136 | 136 | public function searchDoctor(Request $request) |
137 | 137 | { |
138 | - if ($request->nama == null AND $request->location != null){ |
|
138 | + if ($request->nama == null and $request->location != null){ |
|
139 | 139 | $doctor = Doctor::where('city_id',$request->location)->orderBy('name','asc')->paginate(5); |
140 | - }elseif ($request->location == null AND $request->nama != null){ |
|
140 | + }elseif ($request->location == null and $request->nama != null){ |
|
141 | 141 | $doctor = Doctor::where('name','LIKE','%'.$request->nama.'%')->orderBy('name','asc')->paginate(5); |
142 | 142 | }else{ |
143 | 143 | $doctor = Doctor::where('name','LIKE','%'.$request->nama.'%')->where('city_id',$request->location)->orderBy('name','asc')->paginate(5); |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function index() |
20 | 20 | { |
21 | - $doctor = Doctor::orderBy('name','asc')->paginate(10); |
|
21 | + $doctor = Doctor::orderBy('name', 'asc')->paginate(10); |
|
22 | 22 | $data = [ |
23 | 23 | 'role' => session('role'), |
24 | 24 | 'doctor' => $doctor, |
25 | 25 | ]; |
26 | - return view('pages.doctor')->with('data',$data); |
|
26 | + return view('pages.doctor')->with('data', $data); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function store(Request $request) |
48 | 48 | { |
49 | - $this->validate($request,[ |
|
49 | + $this->validate($request, [ |
|
50 | 50 | 'specialty' => 'required', |
51 | 51 | 'name' => 'required|min:3|max:50', |
52 | 52 | 'license' => 'required|min:3|max:191', |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | $doctor->email = $request->input('email'); |
64 | 64 | $doctor->password = Hash::make($request->password); |
65 | 65 | |
66 | - if($doctor->save()) { |
|
67 | - return redirect (route('doctor.index'))->with('success', 'Berhasil Menambahkan Dokter !'); |
|
66 | + if ($doctor->save()) { |
|
67 | + return redirect(route('doctor.index'))->with('success', 'Berhasil Menambahkan Dokter !'); |
|
68 | 68 | } |
69 | 69 | |
70 | - return redirect (route('doctor.index'))->with('failed', 'Gagal menambah dokter !'); |
|
70 | + return redirect(route('doctor.index'))->with('failed', 'Gagal menambah dokter !'); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -78,20 +78,20 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function show($id) |
80 | 80 | { |
81 | - $doctor = Doctor::where('specialization_id',$id)->orderBy('name','asc')->paginate(5); |
|
82 | - $location = City::pluck('name','id'); |
|
81 | + $doctor = Doctor::where('specialization_id', $id)->orderBy('name', 'asc')->paginate(5); |
|
82 | + $location = City::pluck('name', 'id'); |
|
83 | 83 | $data = [ |
84 | 84 | 'doctor' => $doctor, |
85 | 85 | 'location' => $location |
86 | 86 | ]; |
87 | - return view('listDoctor')->with('data',$data); |
|
87 | + return view('listDoctor')->with('data', $data); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | public function showDoctor($id) |
91 | 91 | { |
92 | 92 | $doctor = Doctor::find($id); |
93 | 93 | |
94 | - return view('viewDoctor')->with('doctor',$doctor); |
|
94 | + return view('viewDoctor')->with('doctor', $doctor); |
|
95 | 95 | } |
96 | 96 | /** |
97 | 97 | * Show the form for editing the specified resource. |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function update(Request $request, $id) |
121 | 121 | { |
122 | - $this->validate($request,[ |
|
122 | + $this->validate($request, [ |
|
123 | 123 | 'name' => 'required|min:3|max:50', |
124 | 124 | 'password' => 'required_with:password_confirmation|same:password_confirmation|min:6', |
125 | 125 | 'password_confirmation' => 'min:6' |
@@ -129,29 +129,29 @@ discard block |
||
129 | 129 | $doctor = Doctor::find($id); |
130 | 130 | $doctor->name = $request->input('name'); |
131 | 131 | $doctor->password = $pass; |
132 | - if($doctor->save()) { |
|
133 | - return redirect (route('doctor.index'))->with('success', 'Doktor berhasil di update !'); |
|
132 | + if ($doctor->save()) { |
|
133 | + return redirect(route('doctor.index'))->with('success', 'Doktor berhasil di update !'); |
|
134 | 134 | } |
135 | 135 | |
136 | - return redirect (route('doctor.edit', $id))->with('failed', 'Gagal memperbaharui dokter !'); |
|
136 | + return redirect(route('doctor.edit', $id))->with('failed', 'Gagal memperbaharui dokter !'); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | public function searchDoctor(Request $request) |
140 | 140 | { |
141 | - if ($request->nama == null AND $request->location != null){ |
|
142 | - $doctor = Doctor::where('city_id',$request->location)->orderBy('name','asc')->paginate(5); |
|
143 | - }elseif ($request->location == null AND $request->nama != null){ |
|
144 | - $doctor = Doctor::where('name','LIKE','%'.$request->nama.'%')->orderBy('name','asc')->paginate(5); |
|
145 | - }else{ |
|
146 | - $doctor = Doctor::where('name','LIKE','%'.$request->nama.'%')->where('city_id',$request->location)->orderBy('name','asc')->paginate(5); |
|
141 | + if ($request->nama == null AND $request->location != null) { |
|
142 | + $doctor = Doctor::where('city_id', $request->location)->orderBy('name', 'asc')->paginate(5); |
|
143 | + }elseif ($request->location == null AND $request->nama != null) { |
|
144 | + $doctor = Doctor::where('name', 'LIKE', '%'.$request->nama.'%')->orderBy('name', 'asc')->paginate(5); |
|
145 | + } else { |
|
146 | + $doctor = Doctor::where('name', 'LIKE', '%'.$request->nama.'%')->where('city_id', $request->location)->orderBy('name', 'asc')->paginate(5); |
|
147 | 147 | } |
148 | - $location = City::pluck('name','id'); |
|
148 | + $location = City::pluck('name', 'id'); |
|
149 | 149 | $data = [ |
150 | 150 | 'doctor' => $doctor, |
151 | 151 | 'location' => $location |
152 | 152 | ]; |
153 | 153 | |
154 | - return view('listDoctor')->with('data',$data); |
|
154 | + return view('listDoctor')->with('data', $data); |
|
155 | 155 | |
156 | 156 | } |
157 | 157 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $doctor = Doctor::find($id); |
172 | 172 | $doctor->delete(); |
173 | 173 | |
174 | - return redirect (route('doctor.index')); |
|
174 | + return redirect(route('doctor.index')); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | } |
@@ -9,8 +9,7 @@ discard block |
||
9 | 9 | use Illuminate\Support\Facades\Hash; |
10 | 10 | |
11 | 11 | |
12 | -class DoctorController extends Controller |
|
13 | -{ |
|
12 | +class DoctorController extends Controller { |
|
14 | 13 | /** |
15 | 14 | * Display a listing of the resource. |
16 | 15 | * |
@@ -138,11 +137,11 @@ discard block |
||
138 | 137 | |
139 | 138 | public function searchDoctor(Request $request) |
140 | 139 | { |
141 | - if ($request->nama == null AND $request->location != null){ |
|
140 | + if ($request->nama == null AND $request->location != null) { |
|
142 | 141 | $doctor = Doctor::where('city_id',$request->location)->orderBy('name','asc')->paginate(5); |
143 | - }elseif ($request->location == null AND $request->nama != null){ |
|
142 | + } elseif ($request->location == null AND $request->nama != null) { |
|
144 | 143 | $doctor = Doctor::where('name','LIKE','%'.$request->nama.'%')->orderBy('name','asc')->paginate(5); |
145 | - }else{ |
|
144 | + } else { |
|
146 | 145 | $doctor = Doctor::where('name','LIKE','%'.$request->nama.'%')->where('city_id',$request->location)->orderBy('name','asc')->paginate(5); |
147 | 146 | } |
148 | 147 | $location = City::pluck('name','id'); |