@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $user = null; |
33 | 33 | $err = null; |
34 | 34 | |
35 | - if($provider == 'google') { |
|
35 | + if ($provider == 'google') { |
|
36 | 36 | $user = Socialite::driver($provider)->stateless()->user(); |
37 | 37 | } else { |
38 | 38 | $user = Socialite::driver($provider)->user(); |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | |
41 | 41 | $authUser = $this->findOrCreateUser($user, $provider); |
42 | 42 | |
43 | - $attempt = Auth::guard('web')->attempt(['email' => $authUser->email, 'password' => $authUser->provider_id]); |
|
43 | + $attempt = Auth::guard('web')->attempt([ 'email' => $authUser->email, 'password' => $authUser->provider_id ]); |
|
44 | 44 | |
45 | 45 | $req = new Request([ |
46 | 46 | 'email' => $authUser->email, |
47 | 47 | ]); |
48 | 48 | |
49 | - if($attempt) { |
|
49 | + if ($attempt) { |
|
50 | 50 | $msg = "Selamat Datang ".$authUser->name." !"; |
51 | 51 | return redirect(route('home'))->with('info', $msg); |
52 | 52 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | private function findOrCreateUser($user, $provider) |
66 | 66 | { |
67 | 67 | $authUser = User::where('email', $user->getEmail())->first(); |
68 | - if($authUser) { |
|
68 | + if ($authUser) { |
|
69 | 69 | return $authUser; |
70 | 70 | } |
71 | 71 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | private function sendFailedLoginResponse(Request $request) |
85 | 85 | { |
86 | 86 | throw ValidationException::withMessages([ |
87 | - 'email' => [trans('auth.failed')], |
|
87 | + 'email' => [ trans('auth.failed') ], |
|
88 | 88 | ]); |
89 | 89 | |
90 | 90 | } |
@@ -10,8 +10,7 @@ |
||
10 | 10 | use Illuminate\Validation\ValidationException; |
11 | 11 | use Laravel\Socialite\Facades\Socialite; |
12 | 12 | |
13 | -class OAuthController extends Controller |
|
14 | -{ |
|
13 | +class OAuthController extends Controller { |
|
15 | 14 | |
16 | 15 | public function redirectToProvider($provider) |
17 | 16 | { |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | protected function validator(array $data) |
50 | 50 | { |
51 | 51 | return Validator::make($data, [ |
52 | - 'name' => ['required', 'string', 'max:255'], |
|
53 | - 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], |
|
54 | - 'password' => ['required', 'string', 'min:8', 'confirmed'], |
|
52 | + 'name' => [ 'required', 'string', 'max:255' ], |
|
53 | + 'email' => [ 'required', 'string', 'email', 'max:255', 'unique:users' ], |
|
54 | + 'password' => [ 'required', 'string', 'min:8', 'confirmed' ], |
|
55 | 55 | ]); |
56 | 56 | } |
57 | 57 | |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | protected function create(array $data) |
65 | 65 | { |
66 | 66 | return User::create([ |
67 | - 'name' => $data['name'], |
|
68 | - 'email' => $data['email'], |
|
69 | - 'password' => Hash::make($data['password']), |
|
67 | + 'name' => $data[ 'name' ], |
|
68 | + 'email' => $data[ 'email' ], |
|
69 | + 'password' => Hash::make($data[ 'password' ]), |
|
70 | 70 | ]); |
71 | 71 | } |
72 | 72 | } |
@@ -8,8 +8,7 @@ |
||
8 | 8 | use Illuminate\Support\Facades\Validator; |
9 | 9 | use Illuminate\Foundation\Auth\RegistersUsers; |
10 | 10 | |
11 | -class RegisterController extends Controller |
|
12 | -{ |
|
11 | +class RegisterController extends Controller { |
|
13 | 12 | /* |
14 | 13 | |-------------------------------------------------------------------------- |
15 | 14 | | Register Controller |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | 'password' => 'required|min:6' |
35 | 35 | ]); |
36 | 36 | |
37 | - if($validate->fails()) { |
|
37 | + if ($validate->fails()) { |
|
38 | 38 | return redirect()->back()->withErrors($validate); |
39 | 39 | } |
40 | 40 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ]; |
45 | 45 | |
46 | 46 | // Attempt Login |
47 | - if(Auth::guard('admin')->attempt($credentials, $request->remember)) { |
|
47 | + if (Auth::guard('admin')->attempt($credentials, $request->remember)) { |
|
48 | 48 | // If 'true' -> redirect to admin.index |
49 | 49 | session([ |
50 | 50 | 'role' => 'Admin', |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | private function sendFailedLoginResponse(Request $request) |
61 | 61 | { |
62 | 62 | throw ValidationException::withMessages([ |
63 | - 'email' => [trans('auth.failed')], |
|
63 | + 'email' => [ trans('auth.failed') ], |
|
64 | 64 | ]); |
65 | 65 | } |
66 | 66 |
@@ -8,8 +8,7 @@ |
||
8 | 8 | use Illuminate\Support\Facades\Validator; |
9 | 9 | use Illuminate\Validation\ValidationException; |
10 | 10 | |
11 | -class AdminLoginController extends Controller |
|
12 | -{ |
|
11 | +class AdminLoginController extends Controller { |
|
13 | 12 | |
14 | 13 | public function __construct() |
15 | 14 | { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $specialty->name = $request->input('name'); |
52 | 52 | $specialty->detail = $request->input('detail'); |
53 | 53 | |
54 | - if($specialty->save()) { |
|
54 | + if ($specialty->save()) { |
|
55 | 55 | return redirect(route('specialty.index')); |
56 | 56 | } |
57 | 57 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $specialty->name = $request->input('name'); |
101 | 101 | $specialty->detail = $request->input('detail'); |
102 | 102 | |
103 | - if($specialty->save()) { |
|
103 | + if ($specialty->save()) { |
|
104 | 104 | return redirect(route('specialty.index')); |
105 | 105 | } |
106 | 106 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | public function destroy($id) |
115 | 115 | { |
116 | 116 | $specialty = DoctorSpecialization::find($id); |
117 | - if($specialty->delete()) { |
|
117 | + if ($specialty->delete()) { |
|
118 | 118 | return redirect(route('specialty.index')); |
119 | 119 | } |
120 | 120 | } |
@@ -5,8 +5,7 @@ |
||
5 | 5 | use Illuminate\Http\Request; |
6 | 6 | use App\DoctorSpecialization; |
7 | 7 | |
8 | -class SpecializationController extends Controller |
|
9 | -{ |
|
8 | +class SpecializationController extends Controller { |
|
10 | 9 | /** |
11 | 10 | * Display a listing of the resource. |
12 | 11 | * |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | public function index() |
18 | 18 | { |
19 | - $articles = Articles::orderBy('category','asc')->paginate(5); |
|
19 | + $articles = Articles::orderBy('category', 'asc')->paginate(5); |
|
20 | 20 | $data = [ |
21 | 21 | 'articles' => $articles |
22 | 22 | ]; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function store(Request $request) |
41 | 41 | { |
42 | - $this->validate($request,[ |
|
42 | + $this->validate($request, [ |
|
43 | 43 | 'category' => 'required', |
44 | 44 | 'title' => 'required', |
45 | 45 | 'content' => 'required|min:500', |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | $article->category = $request->input('category'); |
50 | 50 | $article->title = $request->input('title'); |
51 | 51 | $article->content = $request->input('content'); |
52 | - if(session('guard') == 'admin') { |
|
52 | + if (session('guard') == 'admin') { |
|
53 | 53 | $article->admin_id = Auth::guard('admin')->user()->id; |
54 | 54 | } else { |
55 | 55 | $article->doctor_id = Auth::guard('doctor')->user()->id; |
56 | 56 | } |
57 | 57 | |
58 | - if($article->save()) { |
|
59 | - return redirect (route('article.index'))->with('success', 'Artikel baru berhasil ditambahkan !'); |
|
58 | + if ($article->save()) { |
|
59 | + return redirect(route('article.index'))->with('success', 'Artikel baru berhasil ditambahkan !'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | return redirect(route('article.create'))->with('failed', 'Gagal menambahkan artikel.'); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function update(Request $request, $id) |
130 | 130 | { |
131 | - $this->validate($request,[ |
|
131 | + $this->validate($request, [ |
|
132 | 132 | 'category' => 'required', |
133 | 133 | 'title' => 'required', |
134 | 134 | 'content' => 'required|min:500', |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | $article->title = $request->input('title'); |
140 | 140 | $article->content = $request->input('content'); |
141 | 141 | |
142 | - if($article->save()) { |
|
143 | - return redirect (route('article.index'))->with('success', 'Artikel berhasil diubah !'); |
|
142 | + if ($article->save()) { |
|
143 | + return redirect(route('article.index'))->with('success', 'Artikel berhasil diubah !'); |
|
144 | 144 | } |
145 | 145 | |
146 | - return redirect (route('article.edit', $id))->with('failed', 'Gagal mengubah artikel !'); |
|
146 | + return redirect(route('article.edit', $id))->with('failed', 'Gagal mengubah artikel !'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | { |
155 | 155 | $article = Articles::find($id); |
156 | 156 | |
157 | - if($article->delete()) { |
|
157 | + if ($article->delete()) { |
|
158 | 158 | return redirect()->back()->with('success', 'Artikel dihapus !'); |
159 | 159 | } |
160 | 160 |
@@ -9,8 +9,7 @@ |
||
9 | 9 | use App\Admin; |
10 | 10 | use App\Doctor; |
11 | 11 | |
12 | -class ArticleController extends Controller |
|
13 | -{ |
|
12 | +class ArticleController extends Controller { |
|
14 | 13 | /** |
15 | 14 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
16 | 15 | */ |
@@ -17,12 +17,12 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function index() |
19 | 19 | { |
20 | - $hospital = Hospital::orderBy('city_id','asc')->paginate(10); |
|
20 | + $hospital = Hospital::orderBy('city_id', 'asc')->paginate(10); |
|
21 | 21 | $data = [ |
22 | 22 | 'role' => session('role'), |
23 | 23 | 'hospital' => $hospital |
24 | 24 | ]; |
25 | - return view('pages.hospital')->with('data',$data); |
|
25 | + return view('pages.hospital')->with('data', $data); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $hospital->cover_images_id = 1; |
131 | 131 | $hospital->save(); |
132 | 132 | |
133 | - return redirect (route('hospital.index')); |
|
133 | + return redirect(route('hospital.index')); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $hospital = Hospital::find($id); |
145 | 145 | $rooms = $this->deleteRoomsAndRoomDetail($id); |
146 | 146 | |
147 | - if($hospital->delete() && $rooms) { |
|
147 | + if ($hospital->delete() && $rooms) { |
|
148 | 148 | return redirect(route('hospital.index')); |
149 | 149 | } |
150 | 150 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | ->where('hospital_id', '=', $hospital_id) |
165 | 165 | ->delete(); |
166 | 166 | |
167 | - if($delroom && $deldetail) { |
|
167 | + if ($delroom && $deldetail) { |
|
168 | 168 | return true; |
169 | 169 | } |
170 | 170 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $rooms = DB::table('rooms') |
181 | 181 | ->selectRaw(DB::raw('rooms.*')) |
182 | 182 | ->leftJoin('room_details', 'rooms.id', '=', 'room_details.room_id') |
183 | - ->where('room_details.hospital_id','=',$hospital_id) |
|
183 | + ->where('room_details.hospital_id', '=', $hospital_id) |
|
184 | 184 | ->get(); |
185 | 185 | |
186 | 186 | return $rooms; |
@@ -8,8 +8,7 @@ |
||
8 | 8 | use App\Hospital; |
9 | 9 | use App\City; |
10 | 10 | |
11 | -class HospitalController extends Controller |
|
12 | -{ |
|
11 | +class HospitalController extends Controller { |
|
13 | 12 | /** |
14 | 13 | * Display a listing of the resource. |
15 | 14 | * |
@@ -15,12 +15,12 @@ |
||
15 | 15 | |
16 | 16 | public function index() |
17 | 17 | { |
18 | - $user = User::orderBy('name','asc')->paginate(10); |
|
18 | + $user = User::orderBy('name', 'asc')->paginate(10); |
|
19 | 19 | $data = [ |
20 | 20 | 'role' => session('role'), |
21 | 21 | 'user' => $user, |
22 | 22 | ]; |
23 | - return view('pages.member')->with('data',$data); |
|
23 | + return view('pages.member')->with('data', $data); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -5,8 +5,7 @@ |
||
5 | 5 | use Illuminate\Http\Request; |
6 | 6 | use App\User; |
7 | 7 | |
8 | -class MemberController extends Controller |
|
9 | -{ |
|
8 | +class MemberController extends Controller { |
|
10 | 9 | /** |
11 | 10 | * Display a listing of the resource. |
12 | 11 | * |
@@ -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 | /** |
@@ -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 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function update(Request $request, $id) |
105 | 105 | { |
106 | - $this->validate($request,[ |
|
106 | + $this->validate($request, [ |
|
107 | 107 | 'name' => 'required|min:3|max:50', |
108 | 108 | 'password' => 'required_with:password_confirmation|same:password_confirmation|min:6', |
109 | 109 | 'password_confirmation' => 'min:6' |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $doctor = Doctor::find($id); |
129 | 129 | $doctor->delete(); |
130 | 130 | |
131 | - return redirect (route('doctor.index')); |
|
131 | + return redirect(route('doctor.index')); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 |
@@ -9,8 +9,7 @@ |
||
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 | * |
@@ -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', |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $admin->password = Hash::make($request->input('password')); |
85 | 85 | $admin->save(); |
86 | 86 | |
87 | - return redirect ('/admin/admin'); |
|
87 | + return redirect('/admin/admin'); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | |
143 | 143 | $img = null; |
144 | 144 | |
145 | - if($request->hasFile('profile_picture')) { |
|
145 | + if ($request->hasFile('profile_picture')) { |
|
146 | 146 | |
147 | - if( $admin->profile_picture != "user-default.jpg") { |
|
147 | + if ($admin->profile_picture != "user-default.jpg") { |
|
148 | 148 | Storage::delete('public/user_images/'.$admin->profile_picture); |
149 | 149 | } |
150 | 150 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | $admin->name = $request->input('name'); |
164 | 164 | $admin->email = $request->input('email'); |
165 | - if($request->hasFile('profile_picture')) { |
|
165 | + if ($request->hasFile('profile_picture')) { |
|
166 | 166 | $admin->profile_picture = $img; |
167 | 167 | } |
168 | 168 | $admin->save(); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | public function editPass($id) |
182 | 182 | { |
183 | 183 | $admin = $this->currentUser(); |
184 | - if($admin->id == $id) { |
|
184 | + if ($admin->id == $id) { |
|
185 | 185 | $data = [ |
186 | 186 | 'admin' => $admin |
187 | 187 | ]; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | public function updatePass(Request $request, $id) |
202 | 202 | { |
203 | 203 | $admin = $this->currentUser(); |
204 | - if($admin->id == $id) { |
|
204 | + if ($admin->id == $id) { |
|
205 | 205 | |
206 | 206 | $this->validate($request, [ |
207 | 207 | 'old_password' => 'required|min:6', |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | 'password_confirmation' => 'required|min:6' |
210 | 210 | ]); |
211 | 211 | |
212 | - if($this->validatePass($request->input('new_password'))) { |
|
212 | + if ($this->validatePass($request->input('new_password'))) { |
|
213 | 213 | $admin->password = Hash::make($request->input('new_password')); |
214 | 214 | $admin->save(); |
215 | 215 | |
@@ -229,12 +229,12 @@ discard block |
||
229 | 229 | public function removeImage() |
230 | 230 | { |
231 | 231 | $admin = $this->currentUser(); |
232 | - if($admin->profile_picture != "user-default.jpg") { |
|
232 | + if ($admin->profile_picture != "user-default.jpg") { |
|
233 | 233 | Storage::delete('public/user_images/'.$admin->profile_picture); |
234 | 234 | } |
235 | 235 | |
236 | 236 | $admin->profile_picture = "user-default.jpg"; |
237 | - if($admin->save()) { |
|
237 | + if ($admin->save()) { |
|
238 | 238 | return redirect(route('admin.profile.edit', $admin->id))->with('success', 'Foto profil berhasil dihapus !'); |
239 | 239 | } |
240 | 240 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | public function destroy() { |
247 | 247 | $admin = $this->currentUser(); |
248 | 248 | |
249 | - if($admin->delete()) { |
|
249 | + if ($admin->delete()) { |
|
250 | 250 | |
251 | 251 | session()->flush(); |
252 | 252 | return redirect(route('admin.login', $admin->id))->with('success', 'Akun berhasil dihapus !'); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | private function validatePass(string $oldPassword) |
273 | 273 | { |
274 | 274 | $admin = $this->currentUser(); |
275 | - if(Hash::check($oldPassword, $admin->password)) { |
|
275 | + if (Hash::check($oldPassword, $admin->password)) { |
|
276 | 276 | return true; |
277 | 277 | } |
278 | 278 |
@@ -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()) { |