@@ -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 | * |
@@ -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,11 +62,11 @@ discard block |
||
62 | 62 | $doctor->email = $request->input('email'); |
63 | 63 | $doctor->password = Hash::make($request->password); |
64 | 64 | |
65 | - if($doctor->save()) { |
|
66 | - return redirect (route('doctor.index'))->with('success', 'Berhasil Menambahkan Dokter !'); |
|
65 | + if ($doctor->save()) { |
|
66 | + return redirect(route('doctor.index'))->with('success', 'Berhasil Menambahkan Dokter !'); |
|
67 | 67 | } |
68 | 68 | |
69 | - return redirect (route('doctor.index'))->with('failed', 'Gagal menambah dokter !'); |
|
69 | + return redirect(route('doctor.index'))->with('failed', 'Gagal menambah dokter !'); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -77,18 +77,18 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function show($id) |
79 | 79 | { |
80 | - $doctor = Doctor::where('specialization_id',$id)->orderBy('name','asc')->paginate(5); |
|
80 | + $doctor = Doctor::where('specialization_id', $id)->orderBy('name', 'asc')->paginate(5); |
|
81 | 81 | $data = [ |
82 | 82 | 'doctor' => $doctor |
83 | 83 | ]; |
84 | - return view('listDoctor')->with('data',$data); |
|
84 | + return view('listDoctor')->with('data', $data); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | public function showDoctor($id) |
88 | 88 | { |
89 | 89 | $doctor = Doctor::find($id); |
90 | 90 | |
91 | - return view('viewDoctor')->with('doctor',$doctor); |
|
91 | + return view('viewDoctor')->with('doctor', $doctor); |
|
92 | 92 | } |
93 | 93 | /** |
94 | 94 | * Show the form for editing the specified resource. |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function update(Request $request, $id) |
118 | 118 | { |
119 | - $this->validate($request,[ |
|
119 | + $this->validate($request, [ |
|
120 | 120 | 'name' => 'required|min:3|max:50', |
121 | 121 | 'password' => 'required_with:password_confirmation|same:password_confirmation|min:6', |
122 | 122 | 'password_confirmation' => 'min:6' |
@@ -126,28 +126,28 @@ discard block |
||
126 | 126 | $doctor = Doctor::find($id); |
127 | 127 | $doctor->name = $request->input('name'); |
128 | 128 | $doctor->password = $pass; |
129 | - if($doctor->save()) { |
|
130 | - return redirect (route('doctor.index'))->with('success', 'Doktor berhasil di update !'); |
|
129 | + if ($doctor->save()) { |
|
130 | + return redirect(route('doctor.index'))->with('success', 'Doktor berhasil di update !'); |
|
131 | 131 | } |
132 | 132 | |
133 | - return redirect (route('doctor.edit', $id))->with('failed', 'Gagal memperbaharui dokter !'); |
|
133 | + return redirect(route('doctor.edit', $id))->with('failed', 'Gagal memperbaharui dokter !'); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | public function searchDoctor(Request $request) |
137 | 137 | { |
138 | - if ($request->nama == null AND $request->location != null){ |
|
139 | - $doctor = Doctor::where('city_id',$request->location)->orderBy('name','asc')->paginate(5); |
|
140 | - }elseif ($request->location == null AND $request->nama != null){ |
|
141 | - $doctor = Doctor::where('name','LIKE','%'.$request->nama.'%')->orderBy('name','asc')->paginate(5); |
|
142 | - }else{ |
|
143 | - $doctor = Doctor::where('name','LIKE','%'.$request->nama.'%')->where('city_id',$request->location)->orderBy('name','asc')->paginate(5); |
|
138 | + if ($request->nama == null AND $request->location != null) { |
|
139 | + $doctor = Doctor::where('city_id', $request->location)->orderBy('name', 'asc')->paginate(5); |
|
140 | + }elseif ($request->location == null AND $request->nama != null) { |
|
141 | + $doctor = Doctor::where('name', 'LIKE', '%'.$request->nama.'%')->orderBy('name', 'asc')->paginate(5); |
|
142 | + } else { |
|
143 | + $doctor = Doctor::where('name', 'LIKE', '%'.$request->nama.'%')->where('city_id', $request->location)->orderBy('name', 'asc')->paginate(5); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | $data = [ |
147 | 147 | 'doctor' => $doctor, |
148 | 148 | ]; |
149 | 149 | |
150 | - return view('listDoctor')->with('data',$data); |
|
150 | + return view('listDoctor')->with('data', $data); |
|
151 | 151 | |
152 | 152 | } |
153 | 153 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $doctor = Doctor::find($id); |
168 | 168 | $doctor->delete(); |
169 | 169 | |
170 | - return redirect (route('doctor.index')); |
|
170 | + return redirect(route('doctor.index')); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | } |
@@ -8,8 +8,7 @@ discard block |
||
8 | 8 | use Illuminate\Support\Facades\Hash; |
9 | 9 | |
10 | 10 | |
11 | -class DoctorController extends Controller |
|
12 | -{ |
|
11 | +class DoctorController extends Controller { |
|
13 | 12 | /** |
14 | 13 | * Display a listing of the resource. |
15 | 14 | * |
@@ -135,11 +134,11 @@ discard block |
||
135 | 134 | |
136 | 135 | public function searchDoctor(Request $request) |
137 | 136 | { |
138 | - if ($request->nama == null AND $request->location != null){ |
|
137 | + if ($request->nama == null AND $request->location != null) { |
|
139 | 138 | $doctor = Doctor::where('city_id',$request->location)->orderBy('name','asc')->paginate(5); |
140 | - }elseif ($request->location == null AND $request->nama != null){ |
|
139 | + } elseif ($request->location == null AND $request->nama != null) { |
|
141 | 140 | $doctor = Doctor::where('name','LIKE','%'.$request->nama.'%')->orderBy('name','asc')->paginate(5); |
142 | - }else{ |
|
141 | + } else { |
|
143 | 142 | $doctor = Doctor::where('name','LIKE','%'.$request->nama.'%')->where('city_id',$request->location)->orderBy('name','asc')->paginate(5); |
144 | 143 | } |
145 | 144 |
@@ -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); |