Code Duplication    Length = 13-16 lines in 13 locations

app/Http/Controllers/Admin/helpdesk/FormController.php 1 location

@@ 98-113 (lines=16) @@
95
     *
96
     * @return Response
97
     */
98
    public function show($id)
99
    {
100
        try {
101
            $forms = new Forms();
102
            $form = $forms->find($id);
103
            //dd($form);
104
            if ($form) {
105
                $fields = $form->fields();
106
107
                return view('themes.default1.admin.helpdesk.manage.form.preview', compact('form', 'fields'));
108
            }
109
            throw new Exception("Sorry we can't find your request");
110
        } catch (Exception $ex) {
111
            return redirect()->back()->with('fails', $ex->getMessage());
112
        }
113
    }
114
115
    /**
116
     * Store a new form.

app/Http/Controllers/Job/QueueController.php 1 location

@@ 27-40 (lines=14) @@
24
        }
25
    }
26
27
    public function edit($id)
28
    {
29
        try {
30
            $queues = new QueueService();
31
            $queue = $queues->find($id);
32
            if (!$queue) {
33
                throw new Exception('Sorry we can not find your request');
34
            }
35
36
            return view('themes.default1.admin.helpdesk.queue.edit', compact('queue'));
37
        } catch (Exception $ex) {
38
            return redirect()->back()->with('fails', $ex->getMessage());
39
        }
40
    }
41
42
    public function update($id, QueueRequest $request)
43
    {

app/Itil/Controllers/ChangesController.php 1 location

@@ 135-147 (lines=13) @@
132
        }
133
    }
134
135
    public function show($id) {
136
        try {
137
            $changes = new SdChanges();
138
            $change = $changes->find($id);
139
            if ($change) {
140
                return view('itil::changes.show', compact('change'));
141
            } else {
142
                throw new \Exception('Sorry we can not find your request');
143
            }
144
        } catch (Exception $ex) {
145
            return redirect()->back()->with('fails', $ex->getMessage());
146
        }
147
    }
148
149
    public function close($id) {
150
        try {

app/Itil/Controllers/LocationController.php 1 location

@@ 160-172 (lines=13) @@
157
        }
158
    }
159
160
    public function show($id) {
161
        try {
162
            $locations = new Location();
163
            $location = $locations->find($id);
164
            if ($location) {
165
                return view('itil::location.show', compact('location'));
166
            } else {
167
                throw new \Exception('Sorry we can not find your request');
168
            }
169
        } catch (Exception $ex) {
170
            return redirect()->back()->with('fails', $ex->getMessage());
171
        }
172
    }
173
174
    public function getLocationsForForm(Request $request) {
175
        $id = $request->input('id');

app/Itil/Controllers/ProblemController.php 1 location

@@ 285-298 (lines=14) @@
282
        return redirect()->back()->with('success', 'Detached successfully');
283
    }
284
285
    public function show($id) {
286
        try {
287
            $problems = new SdProblem();
288
            $problem = $problems->find($id);
289
            if ($problem) {
290
291
                return view('itil::problem.show', compact('problem'));
292
            } else {
293
                throw new \Exception('Sorry we can not find your request');
294
            }
295
        } catch (\Exception $ex) {
296
            return redirect()->back()->with('fails', $ex->getMessage());
297
        }
298
    }
299
300
    public function close($id) {
301
        try {

app/Itil/Controllers/RelesesController.php 1 location

@@ 45-58 (lines=14) @@
42
        }
43
    }
44
45
    public function view($id) {
46
        try {
47
            $releases = new SdReleases();
48
            $release = $releases->find($id);
49
            //dd($release);
50
            if ($release) {
51
                return view('itil::releases.show', compact('release'));
52
            } else {
53
                throw new \Exception('Sorry we can not find your request');
54
            }
55
        } catch (Exception $ex) {
56
            return redirect()->back()->with('fails', $ex->getMessage());
57
        }
58
    }
59
60
    public function releasescreate() {
61
        try {

app/Plugins/ServiceDesk/Controllers/Assets/AssetController.php 1 location

@@ 349-361 (lines=13) @@
346
        return $fields;
347
    }
348
349
    public function show($id) {
350
        try {
351
            $assets = new SdAssets();
352
            $asset = $assets->find($id);
353
            if ($asset) {
354
                return view("service::assets.show", compact('asset'));
355
            } else {
356
                throw new \Exception('Sorry we can not find your request');
357
            }
358
        } catch (Exception $ex) {
359
            return redirect()->back()->with('fails', $ex->getMessage());
360
        }
361
    }
362
363
    public function saveExternalId($asset) {
364
        $extid = \Input::get('external_id');

app/Plugins/ServiceDesk/Controllers/Changes/ChangesController.php 1 location

@@ 133-145 (lines=13) @@
130
        }
131
    }
132
133
    public function show($id) {
134
        try {
135
            $changes = new SdChanges();
136
            $change = $changes->find($id);
137
            if ($change) {
138
                return view('service::changes.show', compact('change'));
139
            } else {
140
                throw new \Exception('Sorry we can not find your request');
141
            }
142
        } catch (Exception $ex) {
143
            return redirect()->back()->with('fails', $ex->getMessage());
144
        }
145
    }
146
    
147
    public function close($id){
148
        try {

app/Plugins/ServiceDesk/Controllers/Contract/ContractController.php 1 location

@@ 121-133 (lines=13) @@
118
        \App\Plugins\ServiceDesk\Controllers\Library\UtilityController::cabMessage($cabid, $activity, $url);
119
        
120
    }
121
    public function show($id){
122
        try{
123
            $contracts = new SdContract();
124
            $contract = $contracts->find($id);
125
            if($contract){
126
                return view('service::contract.show',  compact('contract'));
127
            }else{
128
                throw new \Exception('Sorry we can not find your request');
129
            }
130
        } catch (Exception $ex) {
131
            return redirect()->back()->with('fails', $ex->getMessage());
132
        }
133
    }
134
135
}
136

app/Plugins/ServiceDesk/Controllers/Location/LocationController.php 1 location

@@ 149-161 (lines=13) @@
146
        }
147
    }
148
149
    public function show($id) {
150
        try {
151
            $locations = new SdLocations();
152
            $location = $locations->find($id);
153
            if ($location) {
154
                return view('service::location.show', compact('location'));
155
            } else {
156
                throw new \Exception('Sorry we can not find your request');
157
            }
158
        } catch (Exception $ex) {
159
            return redirect()->back()->with('fails', $ex->getMessage());
160
        }
161
    }
162
163
    public function getLocationsForForm(Request $request) {
164
        $html = "<option value=''>Select</option>";

app/Plugins/ServiceDesk/Controllers/Problem/ProblemController.php 1 location

@@ 279-292 (lines=14) @@
276
        return redirect()->back()->with('success', 'Detached successfully');
277
    }
278
279
    public function show($id) {
280
        try {
281
            $problems = new SdProblem();
282
            $problem = $problems->find($id);
283
            if ($problem) {
284
285
                return view('service::problem.show', compact('problem'));
286
            } else {
287
                throw new \Exception('Sorry we can not find your request');
288
            }
289
        } catch (\Exception $ex) {
290
            return redirect()->back()->with('fails', $ex->getMessage());
291
        }
292
    }
293
294
    public function close($id) {
295
        try {

app/Plugins/ServiceDesk/Controllers/Products/ProductsController.php 1 location

@@ 134-146 (lines=13) @@
131
        }
132
    }
133
134
    public function show($id) {
135
        try {
136
            $products = new SdProducts();
137
            $product = $products->find($id);
138
            if ($product) {
139
                return view('service::products.show', compact('product'));
140
            } else {
141
                throw new \Exception('Sorry we can not find your request');
142
            }
143
        } catch (Exception $ex) {
144
            return redirect()->back()->with('fails', $ex->getMessage());
145
        }
146
    }
147
148
    public function addVendor(CreateVendorRequest $request) {
149
        try {

app/Plugins/ServiceDesk/Controllers/Releses/RelesesController.php 1 location

@@ 45-59 (lines=15) @@
42
        }
43
    }
44
45
    public function view($id) {
46
        try {
47
            $releases = new SdReleases();
48
            $release = $releases->find($id);
49
            //dd($release);
50
            if($release){
51
                return view('service::releases.show', compact('release'));
52
            }else{
53
                throw new \Exception('Sorry we can not find your request');
54
            }
55
            
56
        } catch (Exception $ex) {
57
            return redirect()->back()->with('fails', $ex->getMessage());
58
        }
59
    }
60
61
    public function releasescreate() {
62
        try {