@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | use App\Http\Controllers\Controller; |
5 | 5 | |
6 | -class BaseServiceDeskController extends Controller{ |
|
6 | +class BaseServiceDeskController extends Controller { |
|
7 | 7 | |
8 | 8 | public function __construct() { |
9 | 9 | \Event::fire('service.desk.activate', array()); |
@@ -149,9 +149,9 @@ |
||
149 | 149 | $changes = new SdChanges(); |
150 | 150 | $change = $changes->find($id); |
151 | 151 | if ($change) { |
152 | - $change->status_id = 6; |
|
153 | - $change->save(); |
|
154 | - return redirect()->back()->with('success','Updated'); |
|
152 | + $change->status_id = 6; |
|
153 | + $change->save(); |
|
154 | + return redirect()->back()->with('success','Updated'); |
|
155 | 155 | } else { |
156 | 156 | throw new \Exception('Sorry we can not find your request'); |
157 | 157 | } |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | public function getChanges() { |
35 | 35 | try { |
36 | 36 | $change = new SdChanges(); |
37 | - $changes = $change->select('id', 'description', 'subject', 'status_id', 'priority_id', 'change_type_id', 'impact_id', 'location_id', 'approval_id')->get(); |
|
37 | + $changes = $change->select('id', 'description', 'subject', 'status_id', 'priority_id', 'change_type_id', 'impact_id', 'location_id', 'approval_id')->get(); |
|
38 | 38 | return \Datatable::Collection($changes) |
39 | 39 | ->showColumns('subject', 'reason') |
40 | 40 | ->addColumn('action', function($model) { |
41 | - $url = url('service-desk/changes/' . $model->id . '/delete'); |
|
41 | + $url = url('service-desk/changes/'.$model->id.'/delete'); |
|
42 | 42 | $delete = \App\Plugins\ServiceDesk\Controllers\Library\UtilityController::deletePopUp($model->id, $url, "Delete $model->subject"); |
43 | 43 | //dd($delete); |
44 | - return "<a href=" . url('service-desk/changes/' . $model->id . '/edit') . " class='btn btn-info btn-sm'>Edit</a> " |
|
44 | + return "<a href=".url('service-desk/changes/'.$model->id.'/edit')." class='btn btn-info btn-sm'>Edit</a> " |
|
45 | 45 | . $delete |
46 | - . " <a href=" . url('service-desk/changes/' . $model->id . '/show') . " class='btn btn-primary btn-sm'>View</a>"; |
|
46 | + . " <a href=".url('service-desk/changes/'.$model->id.'/show')." class='btn btn-primary btn-sm'>View</a>"; |
|
47 | 47 | }) |
48 | 48 | ->searchColumns('description') |
49 | 49 | ->orderColumns('description', 'subject', 'reason', 'status_id', 'priority_id', 'change_type_id', 'impact_id', 'location_id', 'approval_id') |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | - public function close($id){ |
|
147 | + public function close($id) { |
|
148 | 148 | try { |
149 | 149 | $changes = new SdChanges(); |
150 | 150 | $change = $changes->find($id); |
151 | 151 | if ($change) { |
152 | 152 | $change->status_id = 6; |
153 | 153 | $change->save(); |
154 | - return redirect()->back()->with('success','Updated'); |
|
154 | + return redirect()->back()->with('success', 'Updated'); |
|
155 | 155 | } else { |
156 | 156 | throw new \Exception('Sorry we can not find your request'); |
157 | 157 | } |
@@ -160,28 +160,28 @@ discard block |
||
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | - public function getReleases(){ |
|
163 | + public function getReleases() { |
|
164 | 164 | $release = new \App\Plugins\ServiceDesk\Model\Releases\SdReleases(); |
165 | - $releases = $release->select('id','subject')->get(); |
|
165 | + $releases = $release->select('id', 'subject')->get(); |
|
166 | 166 | return \Datatable::Collection($releases) |
167 | - ->addColumn('id',function($model){ |
|
167 | + ->addColumn('id', function($model) { |
|
168 | 168 | return "<input type='radio' name='release' value='".$model->id."'>"; |
169 | 169 | }) |
170 | - ->addColumn('subject',function($model){ |
|
171 | - return str_limit($model->subject,20); |
|
170 | + ->addColumn('subject', function($model) { |
|
171 | + return str_limit($model->subject, 20); |
|
172 | 172 | }) |
173 | 173 | ->orderColumns('subject') |
174 | 174 | ->searchColumns('subject') |
175 | 175 | ->make(); |
176 | 176 | } |
177 | 177 | |
178 | - public function attachNewRelease($id, CreateReleaseRequest $request){ |
|
179 | - try{ |
|
178 | + public function attachNewRelease($id, CreateReleaseRequest $request) { |
|
179 | + try { |
|
180 | 180 | $release_controller = new \App\Plugins\ServiceDesk\Controllers\Releses\RelesesController(); |
181 | 181 | $release = $release_controller->releaseshandleCreate($request, true); |
182 | 182 | $this->releaseAttach($id, $release->id); |
183 | - if($release){ |
|
184 | - return redirect()->back()->with('success','Updated'); |
|
183 | + if ($release) { |
|
184 | + return redirect()->back()->with('success', 'Updated'); |
|
185 | 185 | } |
186 | 186 | } catch (\Exception $ex) { |
187 | 187 | dd($ex); |
@@ -189,22 +189,22 @@ discard block |
||
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | - public function attachExistingRelease($id,Request $request){ |
|
193 | - try{ |
|
192 | + public function attachExistingRelease($id, Request $request) { |
|
193 | + try { |
|
194 | 194 | $releaseid = $request->input('release'); |
195 | 195 | $store = $this->releaseAttach($id, $releaseid); |
196 | - if($store){ |
|
197 | - return redirect()->back()->with('success','Updated'); |
|
196 | + if ($store) { |
|
197 | + return redirect()->back()->with('success', 'Updated'); |
|
198 | 198 | } |
199 | 199 | } catch (\Exception $ex) { |
200 | 200 | return redirect()->back()->with('fails', $ex->getMessage()); |
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
204 | - public function releaseAttach($changeid,$releaseid){ |
|
204 | + public function releaseAttach($changeid, $releaseid) { |
|
205 | 205 | $relation = new \App\Plugins\ServiceDesk\Model\Changes\ChangeReleaseRelation(); |
206 | - $relations = $relation->where('change_id',$changeid)->first(); |
|
207 | - if($relations){ |
|
206 | + $relations = $relation->where('change_id', $changeid)->first(); |
|
207 | + if ($relations) { |
|
208 | 208 | $relations->delete(); |
209 | 209 | } |
210 | 210 | |
@@ -214,14 +214,14 @@ discard block |
||
214 | 214 | ]); |
215 | 215 | } |
216 | 216 | |
217 | - public function detachRelease($changeid){ |
|
218 | - try{ |
|
217 | + public function detachRelease($changeid) { |
|
218 | + try { |
|
219 | 219 | $relations = new \App\Plugins\ServiceDesk\Model\Changes\ChangeReleaseRelation(); |
220 | - $relation = $relations->where('change_id',$changeid)->first(); |
|
221 | - if($relation){ |
|
220 | + $relation = $relations->where('change_id', $changeid)->first(); |
|
221 | + if ($relation) { |
|
222 | 222 | $relation->delete(); |
223 | 223 | } |
224 | - return redirect()->back()->with('success','Updated'); |
|
224 | + return redirect()->back()->with('success', 'Updated'); |
|
225 | 225 | } catch (\Exception $ex) { |
226 | 226 | return redirect()->back()->with('fails', $ex->getMessage()); |
227 | 227 | } |
@@ -46,10 +46,10 @@ |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | public function seed(){ |
49 | - try{ |
|
50 | - $controller = new ServiceDeskSeeder(); |
|
51 | - $controller->run(); |
|
52 | - return 1; |
|
49 | + try{ |
|
50 | + $controller = new ServiceDeskSeeder(); |
|
51 | + $controller->run(); |
|
52 | + return 1; |
|
53 | 53 | } catch (Exception $ex) { |
54 | 54 | dd($ex); |
55 | 55 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | public function activate() { |
14 | 14 | try { |
15 | - if(!Schema::hasTable('sd_assets')){ |
|
15 | + if (!Schema::hasTable('sd_assets')) { |
|
16 | 16 | $this->migrate(); |
17 | 17 | $this->seed(); |
18 | 18 | } |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
36 | - public function migrate(){ |
|
37 | - try{ |
|
36 | + public function migrate() { |
|
37 | + try { |
|
38 | 38 | $path = "app".DIRECTORY_SEPARATOR."Plugins".DIRECTORY_SEPARATOR."ServiceDesk".DIRECTORY_SEPARATOR."database".DIRECTORY_SEPARATOR."migrations"; |
39 | 39 | Artisan::call('migrate', [ |
40 | 40 | '--path' => $path, |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | - public function seed(){ |
|
49 | - try{ |
|
48 | + public function seed() { |
|
49 | + try { |
|
50 | 50 | $controller = new ServiceDeskSeeder(); |
51 | 51 | $controller->run(); |
52 | 52 | return 1; |
@@ -25,7 +25,7 @@ |
||
25 | 25 | return \Datatable::Collection($locationcategory) |
26 | 26 | ->showColumns('name', 'created_at', 'updated_at') |
27 | 27 | ->addColumn('action', function($model) { |
28 | - return "<a href=" . url('service-desk/location-category-types/' . $model->id . '/edit') . " class='btn btn-info btn-xs'>Edit</a>"; |
|
28 | + return "<a href=".url('service-desk/location-category-types/'.$model->id.'/edit')." class='btn btn-info btn-xs'>Edit</a>"; |
|
29 | 29 | }) |
30 | 30 | ->searchColumns('name') |
31 | 31 | ->orderColumns('name', 'created_at', 'updated_at') |
@@ -33,7 +33,7 @@ |
||
33 | 33 | return "<a href=" . url('service-desk/releases/' . $model->id . '/edit') . " class='btn btn-info btn-sm'>Edit</a> " |
34 | 34 | . $delete |
35 | 35 | . " <a href=" . url('service-desk/releases/' . $model->id . '/show') . " class='btn btn-primary btn-sm'>View</a>"; |
36 | - }) |
|
36 | + }) |
|
37 | 37 | ->searchColumns('subject','description') |
38 | 38 | ->orderColumns('subject', 'reason', 'impact', 'rollout_plan', 'backout_plan', 'status_id', 'priority_id', 'change_type_id', 'impact_id', 'location_id', 'approval_id') |
39 | 39 | ->make(); |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | return \Datatable::Collection($relese) |
29 | 29 | ->showColumns('subject', 'planned_start_date', 'planned_end_date') |
30 | 30 | ->addColumn('Action', function($model) { |
31 | - $url = url('service-desk/releases/' . $model->id . '/delete'); |
|
31 | + $url = url('service-desk/releases/'.$model->id.'/delete'); |
|
32 | 32 | $delete = \App\Plugins\ServiceDesk\Controllers\Library\UtilityController::deletePopUp($model->id, $url, "Delete $model->subject"); |
33 | - return "<a href=" . url('service-desk/releases/' . $model->id . '/edit') . " class='btn btn-info btn-sm'>Edit</a> " |
|
33 | + return "<a href=".url('service-desk/releases/'.$model->id.'/edit')." class='btn btn-info btn-sm'>Edit</a> " |
|
34 | 34 | . $delete |
35 | - . " <a href=" . url('service-desk/releases/' . $model->id . '/show') . " class='btn btn-primary btn-sm'>View</a>"; |
|
35 | + . " <a href=".url('service-desk/releases/'.$model->id.'/show')." class='btn btn-primary btn-sm'>View</a>"; |
|
36 | 36 | }) |
37 | - ->searchColumns('subject','description') |
|
37 | + ->searchColumns('subject', 'description') |
|
38 | 38 | ->orderColumns('subject', 'reason', 'impact', 'rollout_plan', 'backout_plan', 'status_id', 'priority_id', 'change_type_id', 'impact_id', 'location_id', 'approval_id') |
39 | 39 | ->make(); |
40 | 40 | } catch (Exception $ex) { |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | $releases = new SdReleases(); |
48 | 48 | $release = $releases->find($id); |
49 | 49 | //dd($release); |
50 | - if($release){ |
|
50 | + if ($release) { |
|
51 | 51 | return view('service::releases.show', compact('release')); |
52 | - }else{ |
|
52 | + } else { |
|
53 | 53 | throw new \Exception('Sorry we can not find your request'); |
54 | 54 | } |
55 | 55 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
76 | - public function releaseshandleCreate(CreateReleaseRequest $request,$return=false) { |
|
76 | + public function releaseshandleCreate(CreateReleaseRequest $request, $return = false) { |
|
77 | 77 | //dd($return); |
78 | 78 | try { |
79 | 79 | // dd($request); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | \App\Plugins\ServiceDesk\Controllers\Library\UtilityController::attachment($sd_releases->id, 'sd_releases', $request->file('attachments')); |
92 | 92 | \App\Plugins\ServiceDesk\Controllers\Library\UtilityController::storeAssetRelation('sd_releases', $sd_releases->id, $request->input('asset')); |
93 | 93 | |
94 | - if($return===false){ |
|
94 | + if ($return === false) { |
|
95 | 95 | return \Redirect::route('service-desk.releases.index')->with('message', 'Release successfully create !!!'); |
96 | 96 | } |
97 | 97 | return $sd_releases; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $sd_release_status = SdReleasestatus::lists('name', 'id')->toArray(); |
107 | 107 | $sd_release_priorities = SdReleasepriorities::lists('name', 'id')->toArray(); |
108 | 108 | $sd_release_types = SdReleasetypes::lists('name', 'id')->toArray(); |
109 | - $sd_locations = SdLocations::lists('title','id')->toArray(); |
|
109 | + $sd_locations = SdLocations::lists('title', 'id')->toArray(); |
|
110 | 110 | $assets = SdAssets::lists('name', 'id')->toArray(); |
111 | 111 | |
112 | 112 | return view('service::releases.edit', compact('assets', 'sd_release_status', 'sd_release_priorities', 'sd_release_types', 'sd_locations', 'locations_address', 'release')); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | - public function releaseshandleEdit($id,CreateReleaseRequest $request) { |
|
118 | + public function releaseshandleEdit($id, CreateReleaseRequest $request) { |
|
119 | 119 | try { |
120 | 120 | |
121 | 121 | $sd_releases = SdReleases::findOrFail($id); |
@@ -140,25 +140,25 @@ discard block |
||
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
143 | - public function sendCab($id,$cabid){ |
|
144 | - $activity='sd_releases'; |
|
143 | + public function sendCab($id, $cabid) { |
|
144 | + $activity = 'sd_releases'; |
|
145 | 145 | $owner = "$activity:$id"; |
146 | 146 | $url = url("service-desk/cabs/vote/$cabid/$owner"); |
147 | 147 | \App\Plugins\ServiceDesk\Controllers\Library\UtilityController::cabMessage($cabid, $activity, $url); |
148 | 148 | |
149 | 149 | } |
150 | 150 | |
151 | - public function complete($id){ |
|
152 | - try{ |
|
151 | + public function complete($id) { |
|
152 | + try { |
|
153 | 153 | $releases = new SdReleases(); |
154 | 154 | $release = $releases->find($id); |
155 | - if($release){ |
|
155 | + if ($release) { |
|
156 | 156 | $release->status_id = 5; |
157 | 157 | $release->save(); |
158 | - }else{ |
|
158 | + } else { |
|
159 | 159 | throw new Exception('Sorry we can not find your request'); |
160 | 160 | } |
161 | - return redirect()->back()->with('success','updated'); |
|
161 | + return redirect()->back()->with('success', 'updated'); |
|
162 | 162 | } catch (Exception $ex) { |
163 | 163 | return redirect()->back()->with('fails', $ex->getMessage()); |
164 | 164 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | //dd($release); |
50 | 50 | if($release){ |
51 | 51 | return view('service::releases.show', compact('release')); |
52 | - }else{ |
|
52 | + } else{ |
|
53 | 53 | throw new \Exception('Sorry we can not find your request'); |
54 | 54 | } |
55 | 55 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | if($release){ |
156 | 156 | $release->status_id = 5; |
157 | 157 | $release->save(); |
158 | - }else{ |
|
158 | + } else{ |
|
159 | 159 | throw new Exception('Sorry we can not find your request'); |
160 | 160 | } |
161 | 161 | return redirect()->back()->with('success','updated'); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | return \Datatable::Collection($license_type) |
25 | 25 | ->showColumns('name', 'created_at', 'updated_at') |
26 | 26 | ->addColumn('action', function($model) { |
27 | - return "<a href=" . url('service-desk/license-types/' . $model->id . '/edit') . " class='btn btn-info btn-xs'>Edit</a>"; |
|
27 | + return "<a href=".url('service-desk/license-types/'.$model->id.'/edit')." class='btn btn-info btn-xs'>Edit</a>"; |
|
28 | 28 | }) |
29 | 29 | ->searchColumns('name', 'created_at', 'updated_at') |
30 | 30 | ->orderColumns('name', 'created_at', 'updated_at') |
@@ -9,43 +9,43 @@ discard block |
||
9 | 9 | class InterfaceController extends BaseServiceDeskController { |
10 | 10 | |
11 | 11 | public function agentSidebar() { |
12 | - $path = app_path() . '/Plugins/ServiceDesk/views/interface'; |
|
12 | + $path = app_path().'/Plugins/ServiceDesk/views/interface'; |
|
13 | 13 | \View::addNamespace('plugins', $path); |
14 | 14 | return view('plugins::agent.sidebar'); |
15 | 15 | } |
16 | 16 | |
17 | 17 | public function agentTopbar() { |
18 | - $path = app_path() . '/Plugins/ServiceDesk/views/interface'; |
|
18 | + $path = app_path().'/Plugins/ServiceDesk/views/interface'; |
|
19 | 19 | \View::addNamespace('plugins', $path); |
20 | 20 | return view('plugins::agent.topbar'); |
21 | 21 | } |
22 | 22 | |
23 | 23 | public function agentTopSubbar() { |
24 | - $path = app_path() . '/Plugins/ServiceDesk/views/interface'; |
|
24 | + $path = app_path().'/Plugins/ServiceDesk/views/interface'; |
|
25 | 25 | \View::addNamespace('plugins', $path); |
26 | 26 | return view('plugins::agent.topsubbar'); |
27 | 27 | } |
28 | 28 | |
29 | 29 | public function adminSidebar() { |
30 | - $path = app_path() . '/Plugins/ServiceDesk/views/interface'; |
|
30 | + $path = app_path().'/Plugins/ServiceDesk/views/interface'; |
|
31 | 31 | \View::addNamespace('plugins', $path); |
32 | 32 | return view('plugins::admin.sidebar'); |
33 | 33 | } |
34 | 34 | |
35 | 35 | public function adminTopbar() { |
36 | - $path = app_path() . '/Plugins/ServiceDesk/views/interface'; |
|
36 | + $path = app_path().'/Plugins/ServiceDesk/views/interface'; |
|
37 | 37 | \View::addNamespace('plugins', $path); |
38 | 38 | return view('plugins::admin.topbar'); |
39 | 39 | } |
40 | 40 | |
41 | 41 | public function adminTopSubbar() { |
42 | - $path = app_path() . '/Plugins/ServiceDesk/views/interface'; |
|
42 | + $path = app_path().'/Plugins/ServiceDesk/views/interface'; |
|
43 | 43 | \View::addNamespace('plugins', $path); |
44 | 44 | return view('plugins::admin.topsubbar'); |
45 | 45 | } |
46 | 46 | |
47 | 47 | public function adminSettings() { |
48 | - $path = app_path() . '/Plugins/ServiceDesk/views/interface'; |
|
48 | + $path = app_path().'/Plugins/ServiceDesk/views/interface'; |
|
49 | 49 | \View::addNamespace('plugins', $path); |
50 | 50 | return view('plugins::admin.settings'); |
51 | 51 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $attachments = new \App\Plugins\ServiceDesk\Model\Common\Attachments(); |
110 | 110 | $atach_owner = str_replace(":", ":$identifier:", $owner); |
111 | 111 | $attachment = $attachments->where('owner', $atach_owner)->first(); |
112 | - if($attachment){ |
|
112 | + if ($attachment) { |
|
113 | 113 | Library\UtilityController::removeAttachment($attachment); |
114 | 114 | } |
115 | 115 | if ($identifier == "solution") { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | return $head; |
39 | 39 | }) |
40 | 40 | ->addColumn('action', function($model) { |
41 | - return "<a href=" . url('service-desk/cabs/' . $model->id . '/edit') . " class='btn btn-info'>Edit</a>"; |
|
41 | + return "<a href=".url('service-desk/cabs/'.$model->id.'/edit')." class='btn btn-info'>Edit</a>"; |
|
42 | 42 | }) |
43 | 43 | ->orderColumns('name', 'head') |
44 | 44 | ->searchColumns('name', 'head') |
@@ -150,20 +150,20 @@ discard block |
||
150 | 150 | $users = new \App\User(); |
151 | 151 | $user = $users->find($userid); |
152 | 152 | $name = ""; |
153 | - if ($user){ |
|
153 | + if ($user) { |
|
154 | 154 | $name = $user->first_name." ".$user->last_name; |
155 | - if($name==" "){ |
|
155 | + if ($name == " ") { |
|
156 | 156 | $name = $user->user_name; |
157 | 157 | } |
158 | 158 | } |
159 | 159 | return ucfirst($name); |
160 | 160 | } |
161 | 161 | |
162 | - public static function checkVote($vote){ |
|
162 | + public static function checkVote($vote) { |
|
163 | 163 | $value = ""; |
164 | - if($vote==1){ |
|
164 | + if ($vote == 1) { |
|
165 | 165 | $value = "Voted for proceed"; |
166 | - }else{ |
|
166 | + } else { |
|
167 | 167 | $value = "Voted for not proceed"; |
168 | 168 | } |
169 | 169 | return $value; |
@@ -163,7 +163,7 @@ |
||
163 | 163 | $value = ""; |
164 | 164 | if($vote==1){ |
165 | 165 | $value = "Voted for proceed"; |
166 | - }else{ |
|
166 | + } else{ |
|
167 | 167 | $value = "Voted for not proceed"; |
168 | 168 | } |
169 | 169 | return $value; |
@@ -38,7 +38,7 @@ |
||
38 | 38 | $this->sendDepartment($department, $message); |
39 | 39 | break; |
40 | 40 | } |
41 | - return redirect()->back()->with('success','Announced'); |
|
41 | + return redirect()->back()->with('success', 'Announced'); |
|
42 | 42 | } catch (Exception $ex) { |
43 | 43 | return redirect()->back()->with('fails', $ex->getMessage()); |
44 | 44 | } |