Passed
Pull Request — master (#59)
by
unknown
04:13
created
app/Http/Controllers/SpecializationController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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::orderBy('name','asc')->pluck('name','id');
140
+        $specialization = DoctorSpecialization::orderBy('created_at', 'desc')->orderBy('name', 'asc')->take(6)->get();
141
+        $location = City::orderBy('name', 'asc')->pluck('name', 'id');
142 142
         $data = [
143 143
             'specialization' => $specialization,
144 144
             'location' => $location
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
 
150 150
     public function searchSpecialty(Request $request)
151 151
     {
152
-        $specialization = DoctorSpecialization::where('name','LIKE','%'.$request->specialty.'%')->orderBy('name','asc')->get();
152
+        $specialization = DoctorSpecialization::where('name', 'LIKE', '%'.$request->specialty.'%')->orderBy('name', 'asc')->get();
153 153
         $data = [
154 154
             'specialization' => $specialization
155 155
         ];
156 156
 
157
-        return view('LSdoctor')->with('data',$data);
157
+        return view('LSdoctor')->with('data', $data);
158 158
     }
159 159
 }
Please login to merge, or discard this patch.
app/Http/Controllers/DoctorController.php 3 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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::orderBy('name','asc')->pluck('name','id');
81
+        $doctor = Doctor::where('specialization_id', $id)->orderBy('name', 'asc')->paginate(5);
82
+        $location = City::orderBy('name', 'asc')->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
 block discarded – undo
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
 block discarded – undo
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::orderBy('name','asc')->pluck('name','id');
148
+        $location = City::orderBy('name', 'asc')->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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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::orderBy('name','asc')->pluck('name','id');
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -138,9 +138,9 @@
 block discarded – undo
138 138
 
139 139
     public function searchDoctor(Request $request)
140 140
     {
141
-        if($request->nama == null AND $request->location != null){
141
+        if($request->nama == null and $request->location != null){
142 142
             $doctor = Doctor::where('city_id',$request->location)->orderBy('name','asc')->paginate(5);
143
-        }elseif ($request->location == null AND $request->nama != null){
143
+        }elseif ($request->location == null and $request->nama != null){
144 144
             $doctor = Doctor::where('name','LIKE','%'.$request->nama.'%')->orderBy('name','asc')->paginate(5);
145 145
         }else{
146 146
             $doctor = Doctor::where('name','LIKE','%'.$request->nama.'%')->where('city_id',$request->location)->orderBy('name','asc')->paginate(5);
Please login to merge, or discard this patch.