SettingsController2::postticket()   B
last analyzed

Complexity

Conditions 2
Paths 13

Size

Total Lines 25
Code Lines 16

Duplication

Lines 25
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
eloc 16
nc 13
nop 3
dl 25
loc 25
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
namespace App\Http\Controllers\Admin\helpdesk;
4
5
// controllers
6
use App\Http\Controllers\Controller;
7
// requests
8
use App\Http\Requests\helpdesk\CompanyRequest;
9
use App\Http\Requests\helpdesk\EmailRequest;
10
use App\Http\Requests\helpdesk\SystemRequest;
11
// models
12
use App\Model\helpdesk\Agent\Department;
13
use App\Model\helpdesk\Email\Emails;
14
use App\Model\helpdesk\Email\Template;
15
use App\Model\helpdesk\Manage\Help_topic;
16
use App\Model\helpdesk\Manage\Sla_plan;
17
use App\Model\helpdesk\Notification\UserNotification;
18
use App\Model\helpdesk\Settings\Access;
19
use App\Model\helpdesk\Settings\Alert;
20
use App\Model\helpdesk\Settings\Company;
21
use App\Model\helpdesk\Settings\Email;
22
use App\Model\helpdesk\Settings\Responder;
23
use App\Model\helpdesk\Settings\System;
24
use App\Model\helpdesk\Settings\Ticket;
25
use App\Model\helpdesk\Ticket\Ticket_Priority;
26
use App\Model\helpdesk\Utility\Date_format;
27
use App\Model\helpdesk\Utility\Date_time_format;
28
use App\Model\helpdesk\Utility\Time_format;
29
use App\Model\helpdesk\Utility\Timezones;
30
use DateTime;
31
// classes
32
use DB;
33
use Exception;
34
use Illuminate\Http\Request;
35
use Input;
36
use Lang;
37
38
/**
39
 * SettingsController.
40
 *
41
 * @author      Ladybird <[email protected]>
42
 */
43
class SettingsController2 extends Controller
44
{
45
    /**
46
     * Create a new controller instance.
47
     *
48
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
49
     */
50
    public function __construct()
51
    {
52
        // $this->smtp();
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
53
        $this->middleware('auth');
54
        $this->middleware('roles');
55
    }
56
57
    /**
58
     * Main Settings Page.
59
     *
60
     * @return type view
61
     */
62
    public function settings()
63
    {
64
        return view('themes.default1.admin.helpdesk.setting');
65
    }
66
67
    public function notificationSettings()
68
    {
69
        return view('themes.default1.admin.helpdesk.settings.notification');
70
    }
71
72 View Code Duplication
    public function deleteReadNoti()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
73
    {
74
        $markasread = UserNotification::where('is_read', '=', 1)->get();
75
        foreach ($markasread as $mark) {
76
            $mark->delete();
77
            \App\Model\helpdesk\Notification\Notification::whereId($mark->notification_id)->delete();
78
        }
79
80
        return redirect()->back()->with('success', 'You have deleted all the read notifications');
81
    }
82
83
    public function deleteNotificationLog()
84
    {
85
        $days = Input::get('no_of_days');
86
        $date = new DateTime();
87
        $date->modify($days.' day');
88
        $formatted_date = $date->format('Y-m-d H:i:s');
89
        $markasread = DB::table('user_notification')->where('created_at', '<=', $formatted_date)->get();
90
        foreach ($markasread as $mark) {
91
            $mark->delete();
92
            \App\Model\helpdesk\Notification\Notification::whereId($mark->notification_id)->delete();
93
        }
94
95
        return redirect()->back()->with('success', 'You have deleted all the notification records since '.$days.' days.');
96
    }
97
98
    /**
99
     * @param int $id
0 ignored issues
show
Bug introduced by
There is no parameter named $id. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
100
     * @param $compant instance of company table
101
     *
102
     * get the form for company setting page
103
     *
104
     * @return Response
105
     */
106 View Code Duplication
    public function getStatuses()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
107
    {
108
        try {
109
            /* fetch the values of company from company table */
110
            $statuss = \DB::table('ticket_status')->get();
111
            /* Direct to Company Settings Page */
112
            return view('themes.default1.admin.helpdesk.settings.status', compact('statuss'));
113
        } catch (Exception $e) {
114
            return redirect()->back()->with('fails', $e->errorInfo[2]);
0 ignored issues
show
Bug introduced by
The property errorInfo does not seem to exist in Exception.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
115
        }
116
    }
117
118
    /**
119
     * @param int $id
120
     * @param $compant instance of company table
121
     *
122
     * get the form for company setting page
123
     *
124
     * @return Response
125
     */
126
    public function editStatuses($id)
127
    {
128
        try {
129
            /* fetch the values of company from company table */
130
            $statuss = \App\Model\helpdesk\Ticket\Ticket_Status::whereId($id)->first();
131
            $statuss->name = Input::get('name');
132
            $statuss->icon_class = Input::get('icon_class');
133
            $statuss->email_user = Input::get('email_user');
134
            $statuss->sort = Input::get('sort');
135
            $delete = Input::get('delete');
136
            if ($delete == 'yes') {
137
                $statuss->state = 'delete';
138
            } else {
139
                $statuss->state = Input::get('state');
140
            }
141
            $statuss->sort = Input::get('sort');
142
            $statuss->save();
143
            /* Direct to Company Settings Page */
144
            return redirect()->back()->with('success', 'Status has been updated!');
145
        } catch (Exception $e) {
146
            return redirect()->back()->with('fails', $e->errorInfo[2]);
0 ignored issues
show
Bug introduced by
The property errorInfo does not seem to exist in Exception.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
147
        }
148
    }
149
150
    public function createStatuses(\App\Model\helpdesk\Ticket\Ticket_Status $statuss)
151
    {
152
        //        try {
153
            /* fetch the values of company from company table */
154
                    $statuss->name = Input::get('name');
0 ignored issues
show
Documentation introduced by
The property name does not exist on object<App\Model\helpdesk\Ticket\Ticket_Status>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
155
        $statuss->icon_class = Input::get('icon_class');
0 ignored issues
show
Documentation introduced by
The property icon_class does not exist on object<App\Model\helpdesk\Ticket\Ticket_Status>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
156
        $statuss->email_user = Input::get('email_user');
0 ignored issues
show
Documentation introduced by
The property email_user does not exist on object<App\Model\helpdesk\Ticket\Ticket_Status>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
157
        $statuss->sort = Input::get('sort');
0 ignored issues
show
Documentation introduced by
The property sort does not exist on object<App\Model\helpdesk\Ticket\Ticket_Status>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
158
        $delete = Input::get('delete');
159
        if ($delete == 'yes') {
160
            $statuss->state = 'delete';
0 ignored issues
show
Documentation introduced by
The property state does not exist on object<App\Model\helpdesk\Ticket\Ticket_Status>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
161
        } else {
162
            $statuss->state = Input::get('state');
0 ignored issues
show
Documentation introduced by
The property state does not exist on object<App\Model\helpdesk\Ticket\Ticket_Status>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
163
        }
164
        $statuss->sort = Input::get('sort');
0 ignored issues
show
Documentation introduced by
The property sort does not exist on object<App\Model\helpdesk\Ticket\Ticket_Status>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
165
        $statuss->save();
166
        /* Direct to Company Settings Page */
167
            return redirect()->back()->with('success', 'Status has been created!');
168
//        } catch (Exception $ex) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
169
//            return redirect()->back()->with('fails', $ex->errorInfo[2]);
170
//        }
171
    }
172
173
    public function deleteStatuses($id)
174
    {
175
        try {
176 View Code Duplication
            if ($id > 5) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
177
                /* fetch the values of company from company table */
178
             \App\Model\helpdesk\Ticket\Ticket_Status::whereId($id)->delete();
179
            /* Direct to Company Settings Page */
180
            return redirect()->back()->with('success', 'Status has been deleted');
181
            } else {
182
                return redirect()->back()->with('failed', 'You cannot delete this status');
183
            }
184
        } catch (Exception $e) {
185
            return redirect()->back()->with('fails', $e->errorInfo[2]);
0 ignored issues
show
Bug introduced by
The property errorInfo does not seem to exist in Exception.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
186
        }
187
    }
188
189
    /**
190
     * @param int $id
0 ignored issues
show
Bug introduced by
There is no parameter named $id. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
191
     * @param $compant instance of company table
192
     *
193
     * get the form for company setting page
194
     *
195
     * @return Response
196
     */
197
    public function getcompany(Company $company)
198
    {
199
        try {
200
            /* fetch the values of company from company table */
201
            $companys = $company->whereId('1')->first();
0 ignored issues
show
Documentation Bug introduced by
The method whereId does not exist on object<App\Model\helpdesk\Settings\Company>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
202
            /* Direct to Company Settings Page */
203
            return view('themes.default1.admin.helpdesk.settings.company', compact('companys'));
204
        } catch (Exception $e) {
205
            return redirect()->back()->with('fails', $e->getMessage());
206
        }
207
    }
208
209
    /**
210
     * Update the specified resource in storage.
211
     *
212
     * @param type int            $id
213
     * @param type Company        $company
214
     * @param type CompanyRequest $request
215
     *
216
     * @return Response
217
     */
218 View Code Duplication
    public function postcompany($id, Company $company, CompanyRequest $request)
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
219
    {
220
        /* fetch the values of company request  */
221
        $companys = $company->whereId('1')->first();
0 ignored issues
show
Documentation Bug introduced by
The method whereId does not exist on object<App\Model\helpdesk\Settings\Company>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
222
        if (Input::file('logo')) {
223
            $name = Input::file('logo')->getClientOriginalName();
224
            $destinationPath = 'uploads/company/';
225
            $fileName = rand(0000, 9999).'.'.$name;
226
            Input::file('logo')->move($destinationPath, $fileName);
227
            $companys->logo = $fileName;
228
        }
229
        if ($request->input('use_logo') == null) {
230
            $companys->use_logo = '0';
231
        }
232
        /* Check whether function success or not */
233
        try {
234
            $companys->fill($request->except('logo'))->save();
235
            /* redirect to Index page with Success Message */
236
            return redirect('getcompany')->with('success', 'Company Updated Successfully');
237
        } catch (Exception $e) {
238
            /* redirect to Index page with Fails Message */
239
            return redirect('getcompany')->with('fails', 'Company can not Updated'.'<li>'.$e->getMessage().'</li>');
240
        }
241
    }
242
243
    /**
244
     * function to delete system logo.
245
     *
246
     *  @return type string
247
     */
248 View Code Duplication
    public function deleteLogo()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
249
    {
250
        $path = $_GET['data1']; //get file path of logo image
251
        if (!unlink($path)) {
252
            return 'false';
253
        } else {
254
            $companys = Company::where('id', '=', 1)->first();
255
            $companys->logo = null;
256
            $companys->use_logo = '0';
257
            $companys->save();
258
259
            return 'true';
260
        }
261
        // return $res;
262
    }
263
264
    /**
265
     * get the form for System setting page.
266
     *
267
     * @param type System           $system
268
     * @param type Department       $department
269
     * @param type Timezones        $timezone
270
     * @param type Date_format      $date
271
     * @param type Date_time_format $date_time
272
     * @param type Time_format      $time
273
     *
274
     * @return type Response
275
     */
276
    public function getsystem(System $system, Department $department, Timezones $timezone, Date_format $date, Date_time_format $date_time, Time_format $time)
277
    {
278
        try {
279
            /* fetch the values of system from system table */
280
            $systems = $system->whereId('1')->first();
0 ignored issues
show
Documentation Bug introduced by
The method whereId does not exist on object<App\Model\helpdesk\Settings\System>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
281
            /* Fetch the values from Department table */
282
            $departments = $department->get();
0 ignored issues
show
Documentation Bug introduced by
The method get does not exist on object<App\Model\helpdesk\Agent\Department>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
283
            /* Fetch the values from Timezones table */
284
            $timezones = $timezone->get();
0 ignored issues
show
Documentation Bug introduced by
The method get does not exist on object<App\Model\helpdesk\Utility\Timezones>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
285
            /* Direct to System Settings Page */
286
            return view('themes.default1.admin.helpdesk.settings.system', compact('systems', 'departments', 'timezones', 'time', 'date', 'date_time'));
287
        } catch (Exception $e) {
288
            return redirect()->back()->with('fails', $e->getMessage());
289
        }
290
    }
291
292
    /**
293
     * Update the specified resource in storage.
294
     *
295
     * @param type int           $id
296
     * @param type System        $system
297
     * @param type SystemRequest $request
298
     *
299
     * @return type Response
300
     */
301
    public function postsystem($id, System $system, SystemRequest $request)
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
302
    {
303
        try {
304
            // dd($request);
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
305
            /* fetch the values of system request  */
306
            $systems = $system->whereId('1')->first();
0 ignored issues
show
Documentation Bug introduced by
The method whereId does not exist on object<App\Model\helpdesk\Settings\System>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
307
            /* fill the values to coompany table */
308
            /* Check whether function success or not */
309
            $systems->fill($request->input())->save();
310
            /* redirect to Index page with Success Message */
311
            return redirect('getsystem')->with('success', 'System Updated Successfully');
312
        } catch (Exception $e) {
313
            /* redirect to Index page with Fails Message */
314
            return redirect('getsystem')->with('fails', 'System can not Updated'.'<li>'.$e->getMessage().'</li>');
315
        }
316
    }
317
318
    /**
319
     * get the form for Ticket setting page.
320
     *
321
     * @param type Ticket     $ticket
322
     * @param type Sla_plan   $sla
323
     * @param type Help_topic $topic
324
     * @param type Priority   $priority
325
     *
326
     * @return type Response
327
     */
328
    public function getticket(Ticket $ticket, Sla_plan $sla, Help_topic $topic, Ticket_Priority $priority)
329
    {
330
        try {
331
            /* fetch the values of ticket from ticket table */
332
            $tickets = $ticket->whereId('1')->first();
0 ignored issues
show
Documentation Bug introduced by
The method whereId does not exist on object<App\Model\helpdesk\Settings\Ticket>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
333
            /* Fetch the values from SLA Plan table */
334
            $slas = $sla->get();
0 ignored issues
show
Documentation Bug introduced by
The method get does not exist on object<App\Model\helpdesk\Manage\Sla_plan>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
335
            /* Fetch the values from Help_topic table */
336
            $topics = $topic->get();
0 ignored issues
show
Documentation Bug introduced by
The method get does not exist on object<App\Model\helpdesk\Manage\Help_topic>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
337
            /* Direct to Ticket Settings Page */
338
            return view('themes.default1.admin.helpdesk.settings.ticket', compact('tickets', 'slas', 'topics', 'priority'));
339
        } catch (Exception $e) {
340
            return redirect()->back()->with('fails', $e->getMessage());
341
        }
342
    }
343
344
    /**
345
     * Update the specified resource in storage.
346
     *
347
     * @param type int     $id
348
     * @param type Ticket  $ticket
349
     * @param type Request $request
350
     *
351
     * @return type Response
352
     */
353 View Code Duplication
    public function postticket($id, Ticket $ticket, Request $request)
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
354
    {
355
        try {
356
            /* fetch the values of ticket request  */
357
            $tickets = $ticket->whereId('1')->first();
0 ignored issues
show
Documentation Bug introduced by
The method whereId does not exist on object<App\Model\helpdesk\Settings\Ticket>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
358
            /* fill the values to coompany table */
359
            $tickets->fill($request->except('captcha', 'claim_response', 'assigned_ticket', 'answered_ticket', 'agent_mask', 'html', 'client_update'))->save();
360
            /* insert checkbox to Database  */
361
            $tickets->captcha = $request->input('captcha');
362
            $tickets->claim_response = $request->input('claim_response');
363
            $tickets->assigned_ticket = $request->input('assigned_ticket');
364
            $tickets->answered_ticket = $request->input('answered_ticket');
365
            $tickets->agent_mask = $request->input('agent_mask');
366
            $tickets->html = $request->input('html');
367
            $tickets->client_update = $request->input('client_update');
368
            $tickets->collision_avoid = $request->input('collision_avoid');
369
            /* Check whether function success or not */
370
            $tickets->save();
371
            /* redirect to Index page with Success Message */
372
            return redirect('getticket')->with('success', 'Ticket Updated Successfully');
373
        } catch (Exception $e) {
374
            /* redirect to Index page with Fails Message */
375
            return redirect('getticket')->with('fails', 'Ticket can not Updated'.'<li>'.$e->getMessage().'</li>');
376
        }
377
    }
378
379
    /**
380
     * get the form for Email setting page.
381
     *
382
     * @param type Email    $email
383
     * @param type Template $template
384
     * @param type Emails   $email1
385
     *
386
     * @return type Response
387
     */
388
    public function getemail(Email $email, Template $template, Emails $email1)
389
    {
390
        try {
391
            /* fetch the values of email from Email table */
392
            $emails = $email->whereId('1')->first();
0 ignored issues
show
Documentation Bug introduced by
The method whereId does not exist on object<App\Model\helpdesk\Settings\Email>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
393
            /* Fetch the values from Template table */
394
            $templates = $template->get();
0 ignored issues
show
Documentation Bug introduced by
The method get does not exist on object<App\Model\helpdesk\Email\Template>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
395
            /* Fetch the values from Emails table */
396
            $emails1 = $email1->get();
0 ignored issues
show
Documentation Bug introduced by
The method get does not exist on object<App\Model\helpdesk\Email\Emails>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
397
            /* Direct to Email Settings Page */
398
            return view('themes.default1.admin.helpdesk.settings.email', compact('emails', 'templates', 'emails1'));
399
        } catch (Exception $e) {
400
            return redirect()->back()->with('fails', $e->getMessage());
401
        }
402
    }
403
404
    /**
405
     * Update the specified resource in storage.
406
     *
407
     * @param type int          $id
408
     * @param type Email        $email
409
     * @param type EmailRequest $request
410
     *
411
     * @return type Response
412
     */
413 View Code Duplication
    public function postemail($id, Email $email, EmailRequest $request)
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
414
    {
415
        try {
416
            /* fetch the values of email request  */
417
            $emails = $email->whereId('1')->first();
0 ignored issues
show
Documentation Bug introduced by
The method whereId does not exist on object<App\Model\helpdesk\Settings\Email>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
418
            /* fill the values to email table */
419
            $emails->fill($request->except('email_fetching', 'all_emails', 'email_collaborator', 'strip', 'attachment'))->save();
420
            /* insert checkboxes  to database */
421
            // $emails->email_fetching = $request->input('email_fetching');
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
422
            // $emails->notification_cron = $request->input('notification_cron');
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
423
            $emails->all_emails = $request->input('all_emails');
424
            $emails->email_collaborator = $request->input('email_collaborator');
425
            $emails->strip = $request->input('strip');
426
            $emails->attachment = $request->input('attachment');
427
            /* Check whether function success or not */
428
            $emails->save();
429
            /* redirect to Index page with Success Message */
430
            return redirect('getemail')->with('success', 'Email Updated Successfully');
431
        } catch (Exception $e) {
432
            /* redirect to Index page with Fails Message */
433
            return redirect('getemail')->with('fails', 'Email can not Updated'.'<li>'.$e->getMessage().'</li>');
434
        }
435
    }
436
437
    /**
438
     * get the form for cron job setting page.
439
     *
440
     * @param type Email    $email
441
     * @param type Template $template
442
     * @param type Emails   $email1
443
     *
444
     * @return type Response
445
     */
446 View Code Duplication
    public function getSchedular(Email $email, Template $template, Emails $email1)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
447
    {
448
        // try {
449
             /* fetch the values of email from Email table */
450
            $emails = $email->whereId('1')->first();
0 ignored issues
show
Documentation Bug introduced by
The method whereId does not exist on object<App\Model\helpdesk\Settings\Email>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
451
            /* Fetch the values from Template table */
452
            $templates = $template->get();
0 ignored issues
show
Documentation Bug introduced by
The method get does not exist on object<App\Model\helpdesk\Email\Template>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
453
            /* Fetch the values from Emails table */
454
            $emails1 = $email1->get();
0 ignored issues
show
Documentation Bug introduced by
The method get does not exist on object<App\Model\helpdesk\Email\Emails>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
455
456
        return view('themes.default1.admin.helpdesk.settings.crone', compact('emails', 'templates', 'emails1'));
457
        // } catch {
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
458
459
        // }
460
    }
461
462
    /**
463
     * Update the specified resource in storage for cron job.
464
     *
465
     * @param type Email        $email
466
     * @param type EmailRequest $request
467
     *
468
     * @return type Response
469
     */
470
    public function postSchedular(Email $email, Template $template, Emails $email1, Request $request)
0 ignored issues
show
Unused Code introduced by
The parameter $template is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $email1 is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
471
    {
472
        // dd($request);
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
473
        try {
474
            /* fetch the values of email request  */
475
            $emails = $email->whereId('1')->first();
0 ignored issues
show
Documentation Bug introduced by
The method whereId does not exist on object<App\Model\helpdesk\Settings\Email>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
476
            if ($request->email_fetching) {
477
                $emails->email_fetching = $request->email_fetching;
478
            } else {
479
                $emails->email_fetching = 0;
480
            }
481
            if ($request->notification_cron) {
482
                $emails->notification_cron = $request->notification_cron;
483
            } else {
484
                $emails->notification_cron = 0;
485
            }
486
            $emails->save();
487
            /* redirect to Index page with Success Message */
488
            return redirect('job-scheduler')->with('success', Lang::get('lang.job-scheduler-success'));
489
        } catch (Exception $e) {
490
            /* redirect to Index page with Fails Message */
491
            return redirect('job-scheduler')->with('fails', Lang::get('lang.job-scheduler-error').'<li>'.$e->getMessage().'</li>');
492
        }
493
    }
494
495
    /**
496
     * get the form for Access setting page.
497
     *
498
     * @param type Access $access
499
     *
500
     * @return type Response
501
     */
502
    // public function getaccess(Access $access) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
47% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
503
    // 	try {
504
    // 		/* fetch the values of access from access table */
505
    // 		$accesses = $access->whereId('1')->first();
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
506
//	// 		 Direct to Access Settings Page
507
    // 		return view('themes.default1.admin.helpdesk.settings.access', compact('accesses'));
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
508
    // 	} catch (Exception $e) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
509
    // 		return view('404');
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
510
    // 	}
511
    // }
512
513
    /**
514
     * Update the specified resource in storage.
515
     *
516
     * @param type Access  $access
517
     * @param type Request $request
518
     *
519
     * @return type Response
520
     */
521
    // public function postaccess(Access $access, Request $request) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
522
    // 	try {
523
    // 		/* fetch the values of access request  */
524
    // 		$accesses = $access->whereId('1')->first();
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
525
    // 		/* fill the values to access table */
526
    // 		$accesses->fill($request->except('password_reset', 'bind_agent_ip', 'reg_require', 'quick_access'))->save();
0 ignored issues
show
Unused Code Comprehensibility introduced by
74% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
527
    // 		/* insert checkbox value to DB  */
528
    // 		$accesses->password_reset = $request->input('password_reset');
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
529
    // 		$accesses->bind_agent_ip = $request->input('bind_agent_ip');
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
530
    // 		$accesses->reg_require = $request->input('reg_require');
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
531
    // 		$accesses->quick_access = $request->input('quick_access');
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
532
    // 		/* Check whether function success or not */
533
    // 		if ($accesses->save() == true) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
57% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
534
    // 			/* redirect to Index page with Success Message */
535
    // 			return redirect('getaccess')->with('success', 'Access Updated Successfully');
0 ignored issues
show
Unused Code Comprehensibility introduced by
69% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
536
    // 		} else {
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
537
    // 			/* redirect to Index page with Fails Message */
538
    // 			return redirect('getaccess')->with('fails', 'Access can not Updated');
0 ignored issues
show
Unused Code Comprehensibility introduced by
69% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
539
    // 		}
540
    // 	} catch (Exception $e) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
541
    // 		/* redirect to Index page with Fails Message */
542
    // 		return redirect('getaccess')->with('fails', 'Access can not Updated');
0 ignored issues
show
Unused Code Comprehensibility introduced by
69% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
543
    // 	}
544
    // }
545
546
    /**
547
     * get the form for Responder setting page.
548
     *
549
     * @param type Responder $responder
550
     *
551
     * @return type Response
552
     */
553
    public function getresponder(Responder $responder)
554
    {
555
        try {
556
            /* fetch the values of responder from responder table */
557
            $responders = $responder->whereId('1')->first();
0 ignored issues
show
Documentation Bug introduced by
The method whereId does not exist on object<App\Model\helpdesk\Settings\Responder>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
558
            /* Direct to Responder Settings Page */
559
            return view('themes.default1.admin.helpdesk.settings.responder', compact('responders'));
560
        } catch (Exception $e) {
561
            return redirect()->back()->with('fails', $e->getMessage());
562
        }
563
    }
564
565
    /**
566
     * Update the specified resource in storage.
567
     *
568
     * @param type Responder $responder
569
     * @param type Request   $request
570
     *
571
     * @return type
572
     */
573 View Code Duplication
    public function postresponder(Responder $responder, Request $request)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
574
    {
575
        try {
576
            /* fetch the values of responder request  */
577
            $responders = $responder->whereId('1')->first();
0 ignored issues
show
Documentation Bug introduced by
The method whereId does not exist on object<App\Model\helpdesk\Settings\Responder>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
578
            /* insert Checkbox value to DB */
579
            $responders->new_ticket = $request->input('new_ticket');
580
            $responders->agent_new_ticket = $request->input('agent_new_ticket');
581
            $responders->submitter = $request->input('submitter');
582
            $responders->participants = $request->input('participants');
583
            $responders->overlimit = $request->input('overlimit');
584
            /* fill the values to coompany table */
585
            /* Check whether function success or not */
586
            $responders->save();
587
            /* redirect to Index page with Success Message */
588
            return redirect('getresponder')->with('success', 'Responder Updated Successfully');
589
        } catch (Exception $e) {
590
            /* redirect to Index page with Fails Message */
591
            return redirect('getresponder')->with('fails', 'Responder can not Updated'.'<li>'.$e->getMessage().'</li>');
592
        }
593
    }
594
595
    /**
596
     * get the form for Alert setting page.
597
     *
598
     * @param type Alert $alert
599
     *
600
     * @return type Response
601
     */
602
    public function getalert(Alert $alert)
603
    {
604
        try {
605
            /* fetch the values of alert from alert table */
606
            $alerts = $alert->whereId('1')->first();
0 ignored issues
show
Documentation Bug introduced by
The method whereId does not exist on object<App\Model\helpdesk\Settings\Alert>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
607
            /* Direct to Alert Settings Page */
608
            return view('themes.default1.admin.helpdesk.settings.alert', compact('alerts'));
609
        } catch (Exception $e) {
610
            return redirect()->back()->with('fails', $e->getMessage());
611
        }
612
    }
613
614
    /**
615
     * Update the specified resource in storage.
616
     *
617
     * @param type         $id
618
     * @param type Alert   $alert
619
     * @param type Request $request
620
     *
621
     * @return type Response
622
     */
623 View Code Duplication
    public function postalert($id, Alert $alert, Request $request)
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
624
    {
625
        try {
626
            /* fetch the values of alert request  */
627
            $alerts = $alert->whereId('1')->first();
0 ignored issues
show
Documentation Bug introduced by
The method whereId does not exist on object<App\Model\helpdesk\Settings\Alert>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
628
            /* Insert Checkbox to DB */
629
            $alerts->assignment_status = $request->input('assignment_status');
630
            $alerts->ticket_status = $request->input('ticket_status');
631
            $alerts->overdue_department_member = $request->input('overdue_department_member');
632
            $alerts->sql_error = $request->input('sql_error');
633
            $alerts->excessive_failure = $request->input('excessive_failure');
634
            $alerts->overdue_status = $request->input('overdue_status');
635
            $alerts->overdue_assigned_agent = $request->input('overdue_assigned_agent');
636
            $alerts->overdue_department_manager = $request->input('overdue_department_manager');
637
            $alerts->internal_status = $request->input('internal_status');
638
            $alerts->internal_last_responder = $request->input('internal_last_responder');
639
            $alerts->internal_assigned_agent = $request->input('internal_assigned_agent');
640
            $alerts->internal_department_manager = $request->input('internal_department_manager');
641
            $alerts->assignment_assigned_agent = $request->input('assignment_assigned_agent');
642
            $alerts->assignment_team_leader = $request->input('assignment_team_leader');
643
            $alerts->assignment_team_member = $request->input('assignment_team_member');
644
            $alerts->system_error = $request->input('system_error');
645
            $alerts->transfer_department_member = $request->input('transfer_department_member');
646
            $alerts->transfer_department_manager = $request->input('transfer_department_manager');
647
            $alerts->transfer_assigned_agent = $request->input('transfer_assigned_agent');
648
            $alerts->transfer_status = $request->input('transfer_status');
649
            $alerts->message_organization_accmanager = $request->input('message_organization_accmanager');
650
            $alerts->message_department_manager = $request->input('message_department_manager');
651
            $alerts->message_assigned_agent = $request->input('message_assigned_agent');
652
            $alerts->message_last_responder = $request->input('message_last_responder');
653
            $alerts->message_status = $request->input('message_status');
654
            $alerts->ticket_organization_accmanager = $request->input('ticket_organization_accmanager');
655
            $alerts->ticket_department_manager = $request->input('ticket_department_manager');
656
            $alerts->ticket_department_member = $request->input('ticket_department_member');
657
            $alerts->ticket_admin_email = $request->input('ticket_admin_email');
658
659
            if ($request->input('system_error') == null) {
660
                $str = '%0%';
661
                $path = app_path('../config/app.php');
662
                $content = \File::get($path);
663
                $content = str_replace('%1%', $str, $content);
664
                \File::put($path, $content);
665
            } else {
666
                $str = '%1%';
667
                $path = app_path('../config/app.php');
668
                $content = \File::get($path);
669
                $content = str_replace('%0%', $str, $content);
670
                \File::put($path, $content);
671
            }
672
            /* fill the values to coompany table */
673
            /* Check whether function success or not */
674
            $alerts->save();
675
            /* redirect to Index page with Success Message */
676
            return redirect('getalert')->with('success', 'Alert Updated Successfully');
677
        } catch (Exception $e) {
678
            /* redirect to Index page with Fails Message */
679
            return redirect('getalert')->with('fails', 'Alert can not Updated'.'<li>'.$e->getMessage().'</li>');
680
        }
681
    }
682
683
    /**
684
     * 	To display the list of ratings in the system.
685
     *
686
     *  @return type View
687
     */
688
    public function RatingSettings()
689
    {
690
        $ratings = DB::table('settings_ratings')->get();
691
692
        return view('themes.default1.admin.helpdesk.settings.ratings', compact('ratings'));
693
    }
694
695
    /**
696
     * 	To store rating data.
697
     *
698
     *  @return type Redirect
699
     */
700 View Code Duplication
    public function PostRatingSettings($slug)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
701
    {
702
        $name = Input::get('rating_name');
703
        $publish = Input::get('publish');
704
        $modify = Input::get('modify');
705
        DB::table('settings_ratings')->whereSlug($slug)->update(['rating_name' => $name, 'publish' => $publish, 'modify' => $modify]);
706
707
        return redirect()->back()->with('success', 'Successfully updated');
708
    }
709
710 View Code Duplication
    public function createRating()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
711
    {
712
        $name = Input::get('rating_name');
713
        $publish = Input::get('publish');
714
        $modify = Input::get('modify');
715
        DB::table('settings_ratings')->insert(['rating_name' => $name, 'publish' => $publish, 'modify' => $modify]);
716
717
        return redirect()->back()->with('success', 'Successfully created this rating');
718
    }
719
720
    /**
721
     *  To delete a type of rating.
722
     *
723
     * 	@return type Redirect
724
     */
725
    public function RatingDelete($slug)
726
    {
727
        DB::table('settings_ratings')->whereSlug($slug)->delete();
728
729
        return redirect()->back()->with('success', 'Successfully Deleted');
730
    }
731
732
    /**
733
     *  Generate Api key.
734
     *
735
     *  @return type json
736
     */
737
    public function generateApiKey()
738
    {
739
        $key = str_random(32);
740
741
        return $key;
742
    }
743
}
744