@@ -10,8 +10,7 @@ |
||
10 | 10 | use App\Articles; |
11 | 11 | |
12 | 12 | |
13 | -class UserController extends Controller |
|
14 | -{ |
|
13 | +class UserController extends Controller { |
|
15 | 14 | /** |
16 | 15 | * Create a new controller instance. |
17 | 16 | * |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function __construct() |
22 | 22 | { |
23 | - $this->middleware('auth', ['except' => [ |
|
23 | + $this->middleware('auth', [ 'except' => [ |
|
24 | 24 | 'index', |
25 | 25 | 'showArticle' |
26 | - ]]); |
|
26 | + ] ]); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public function index() |
34 | 34 | { |
35 | 35 | $threads = Thread::orderBy('created_at', 'desc')->paginate(5); |
36 | - $articles = Articles::where('category','penyakit')->orderBy('created_at','desc')->take(3)->get(); |
|
36 | + $articles = Articles::where('category', 'penyakit')->orderBy('created_at', 'desc')->take(3)->get(); |
|
37 | 37 | $data = [ |
38 | 38 | 'threads' => $threads, |
39 | 39 | 'articles' => $articles |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | public function profile($query) |
52 | 52 | { |
53 | 53 | $threads = null; |
54 | - if($query == "all") { |
|
54 | + if ($query == "all") { |
|
55 | 55 | $threads = Thread::where('user_id', $this->currentUser()->id) |
56 | 56 | ->orderBy('updated_at', 'desc') |
57 | 57 | ->paginate(3); |
58 | - } elseif($query == "answered") { |
|
58 | + } elseif ($query == "answered") { |
|
59 | 59 | $threads = Thread::where('user_id', $this->currentUser()->id) |
60 | 60 | ->where('status', true) |
61 | 61 | ->orderBy('updated_at', 'desc') |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | public function edit($id) |
79 | 79 | { |
80 | 80 | $user = $this->currentUser(); |
81 | - if($user->id == $id) { |
|
81 | + if ($user->id == $id) { |
|
82 | 82 | $data = [ |
83 | 83 | 'user' => $user |
84 | 84 | ]; |
85 | - return view ('profile-edit')->with('data', $data); |
|
85 | + return view('profile-edit')->with('data', $data); |
|
86 | 86 | } |
87 | 87 | return redirect()->back()->with('warning', 'Anda tidak berhak untuk mengakses laman tersebut.'); |
88 | 88 | } |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | public function editPass($id) |
96 | 96 | { |
97 | 97 | $user = $this->currentUser(); |
98 | - if($user->id == $id) { |
|
98 | + if ($user->id == $id) { |
|
99 | 99 | $data = [ |
100 | 100 | 'user' => $user |
101 | 101 | ]; |
102 | - return view ('profile-password')->with('data', $data); |
|
102 | + return view('profile-password')->with('data', $data); |
|
103 | 103 | } |
104 | 104 | return redirect()->back()->with('warning', 'Anda tidak berhak untuk mengakses laman tersebut.'); |
105 | 105 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function update(Request $request, $id) |
115 | 115 | { |
116 | - $this->validate($request,[ |
|
116 | + $this->validate($request, [ |
|
117 | 117 | 'name' => 'required|min:3', |
118 | 118 | 'email' => 'required|email', |
119 | 119 | 'image' => 'image|nullable|max:3999' |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | $img = null; |
123 | 123 | $user = $this->currentUser(); |
124 | 124 | |
125 | - if($request->hasFile('image')) { |
|
125 | + if ($request->hasFile('image')) { |
|
126 | 126 | |
127 | - if( $user->profile_picture != "user-default.jpg" && |
|
127 | + if ($user->profile_picture != "user-default.jpg" && |
|
128 | 128 | $user->profile_picture != "user-default-male.png" && |
129 | 129 | $user->profile_picture != "user-default-female.png") { |
130 | 130 | |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | |
154 | - if($this->currentUser()->id == $id) { |
|
154 | + if ($this->currentUser()->id == $id) { |
|
155 | 155 | $user->name = $request->input('name'); |
156 | 156 | $user->biography = $request->input('bio'); |
157 | 157 | $user->gender = $request->input('gender'); |
158 | 158 | $user->profile_picture = $img; |
159 | 159 | $user->save(); |
160 | 160 | |
161 | - return redirect (route('user.profile.edit', ['id' => $id]))->with('success', 'Profil berhasil diperbarui !'); |
|
161 | + return redirect(route('user.profile.edit', [ 'id' => $id ]))->with('success', 'Profil berhasil diperbarui !'); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | return redirect()->back()->with('warning', 'Anda tidak berhak untuk mengakses laman tersebut.'); |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | |
181 | 181 | $user = $this->currentUser(); |
182 | 182 | |
183 | - if($this->validatePass($request->input('old_password'))) { |
|
183 | + if ($this->validatePass($request->input('old_password'))) { |
|
184 | 184 | $user->password = Hash::make($request->input('new_password')); |
185 | 185 | |
186 | - if($user->save()) { |
|
186 | + if ($user->save()) { |
|
187 | 187 | session()->flush(); |
188 | 188 | |
189 | 189 | return redirect(route('login'))->with('success', 'Password berhasil diubah ! Silahkan login kembali.'); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | public function showArticle($id) |
202 | 202 | { |
203 | 203 | $article = Articles::find($id); |
204 | - return view('viewarticle')->with('article',$article); |
|
204 | + return view('viewarticle')->with('article', $article); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | |
@@ -213,23 +213,23 @@ discard block |
||
213 | 213 | $user = $this->currentUser(); |
214 | 214 | $img = null; |
215 | 215 | |
216 | - if( $user->profile_picture != "user-default.jpg" && |
|
216 | + if ($user->profile_picture != "user-default.jpg" && |
|
217 | 217 | $user->profile_picture != "user-default-male.png" && |
218 | 218 | $user->profile_picture != "user-default-female.png") { |
219 | 219 | |
220 | 220 | Storage::delete('public/user_images/'.$user->profile_picture); |
221 | 221 | } |
222 | 222 | |
223 | - if( $user->gender != null && $user->gender == "Laki - laki") { |
|
223 | + if ($user->gender != null && $user->gender == "Laki - laki") { |
|
224 | 224 | $img = "user-default-male.png"; |
225 | - } elseif($user->gender != null && $user->gender == "Perempuan") { |
|
225 | + } elseif ($user->gender != null && $user->gender == "Perempuan") { |
|
226 | 226 | $img = "user-default-female.png"; |
227 | 227 | } else { |
228 | 228 | $img = "user-default.jpg"; |
229 | 229 | } |
230 | 230 | |
231 | 231 | $user->profile_picture = $img; |
232 | - if($user->save()) { |
|
232 | + if ($user->save()) { |
|
233 | 233 | return redirect(route('user.profile.edit', $user->id))->with('success', 'Foto profil dihapus !'); |
234 | 234 | } |
235 | 235 | } |
@@ -241,14 +241,14 @@ discard block |
||
241 | 241 | public function destroy() |
242 | 242 | { |
243 | 243 | $user = $this->currentUser(); |
244 | - if( $user->profile_picture != "user-default.jpg" && |
|
244 | + if ($user->profile_picture != "user-default.jpg" && |
|
245 | 245 | $user->profile_picture != "user-default-male.png" && |
246 | 246 | $user->profile_picture != "user-default-female.png") { |
247 | 247 | |
248 | 248 | Storage::delete('public/user_images/'.$user->profile_picture); |
249 | 249 | } |
250 | 250 | |
251 | - if($user->delete()) { |
|
251 | + if ($user->delete()) { |
|
252 | 252 | session()->flush(); |
253 | 253 | return redirect(route('home'))->with('success', 'Akun berhasil dihapus !'); |
254 | 254 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | private function validatePass(string $oldPassword) |
272 | 272 | { |
273 | 273 | $user = $this->currentUser(); |
274 | - if(Hash::check($oldPassword, $user->password)) { |
|
274 | + if (Hash::check($oldPassword, $user->password)) { |
|
275 | 275 | return true; |
276 | 276 | } |
277 | 277 | return false; |
@@ -5,8 +5,7 @@ |
||
5 | 5 | use App\DoctorDetail; |
6 | 6 | use Illuminate\Http\Request; |
7 | 7 | |
8 | -class DoctorDetailController extends Controller |
|
9 | -{ |
|
8 | +class DoctorDetailController extends Controller { |
|
10 | 9 | /** |
11 | 10 | * Display a listing of the resource. |
12 | 11 | * |
@@ -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 |
@@ -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 @@ |
||
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 |