UserAttribute   B
last analyzed

Complexity

Total Complexity 45

Size/Duplication

Total Lines 280
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 45
eloc 80
dl 0
loc 280
rs 8.8
c 0
b 0
f 0

12 Methods

Rating   Name   Duplication   Size   Complexity  
A getPictureAttribute() 0 3 1
A isPending() 0 3 2
A getEditButtonAttribute() 0 3 1
A getChangePasswordButtonAttribute() 0 3 1
A getNameAttribute() 0 3 1
A getStatusButtonAttribute() 0 25 4
A getConfirmedButtonAttribute() 0 7 3
A getFullNameAttribute() 0 5 2
A getConfirmedLabelAttribute() 0 12 4
A getActionButtonsAttribute() 0 15 2
A getDeleteButtonAttribute() 0 12 3
A getClearSessionButtonAttribute() 0 11 3

How to fix   Complexity   

Complex Class

Complex classes like UserAttribute often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use UserAttribute, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
namespace App\Models\Access\User\Traits\Attribute;
4
5
/**
6
 * Class UserAttribute.
7
 */
8
trait UserAttribute
9
{
10
    /**
11
     * @return mixed
12
     */
13
    public function canChangeEmail()
14
    {
15
        return config('access.users.change_email');
16
    }
17
18
    /**
19
     * @return bool
20
     */
21
    public function canChangePassword()
22
    {
23
        return ! app('session')->has(config('access.socialite_session_name'));
24
    }
25
26
    /**
27
     * @return string
28
     */
29
    public function getStatusLabelAttribute()
30
    {
31
        if ($this->isActive()) {
32
            return "<label class='label label-success'>" . trans('labels.general.active') . '</label>';
0 ignored issues
show
Bug introduced by
Are you sure trans('labels.general.active') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

32
            return "<label class='label label-success'>" . /** @scrutinizer ignore-type */ trans('labels.general.active') . '</label>';
Loading history...
33
        }
34
35
        return "<label class='label label-danger'>" . trans('labels.general.inactive') . '</label>';
0 ignored issues
show
Bug introduced by
Are you sure trans('labels.general.inactive') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

35
        return "<label class='label label-danger'>" . /** @scrutinizer ignore-type */ trans('labels.general.inactive') . '</label>';
Loading history...
36
    }
37
38
    /**
39
     * @return string
40
     */
41
    public function getConfirmedLabelAttribute()
42
    {
43
        if ($this->isConfirmed()) {
44
            if ($this->id != 1 && $this->id != access()->id()) {
0 ignored issues
show
Bug introduced by
The method id() does not exist on Illuminate\Foundation\Application. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

44
            if ($this->id != 1 && $this->id != access()->/** @scrutinizer ignore-call */ id()) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
45
                return '<a href="' . route('admin.access.user.unconfirm',
46
                        $this) . '" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.access.users.unconfirm') . '" name="confirm_item"><label class="label label-success" style="cursor:pointer">' . trans('labels.general.yes') . '</label></a>';
0 ignored issues
show
Bug introduced by
$this of type App\Models\Access\User\T...Attribute\UserAttribute is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

46
                        /** @scrutinizer ignore-type */ $this) . '" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.access.users.unconfirm') . '" name="confirm_item"><label class="label label-success" style="cursor:pointer">' . trans('labels.general.yes') . '</label></a>';
Loading history...
Bug introduced by
Are you sure trans('buttons.backend.access.users.unconfirm') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

46
                        $this) . '" data-toggle="tooltip" data-placement="top" title="' . /** @scrutinizer ignore-type */ trans('buttons.backend.access.users.unconfirm') . '" name="confirm_item"><label class="label label-success" style="cursor:pointer">' . trans('labels.general.yes') . '</label></a>';
Loading history...
Bug introduced by
Are you sure trans('labels.general.yes') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

46
                        $this) . '" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.access.users.unconfirm') . '" name="confirm_item"><label class="label label-success" style="cursor:pointer">' . /** @scrutinizer ignore-type */ trans('labels.general.yes') . '</label></a>';
Loading history...
47
            } else {
48
                return '<label class="label label-success">' . trans('labels.general.yes') . '</label>';
49
            }
50
        }
51
52
        return '<a href="' . route('admin.access.user.confirm', $this) . '" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.access.users.confirm') . '" name="confirm_item"><label class="label label-danger" style="cursor:pointer">' . trans('labels.general.no') . '</label></a>';
0 ignored issues
show
Bug introduced by
Are you sure trans('buttons.backend.access.users.confirm') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

52
        return '<a href="' . route('admin.access.user.confirm', $this) . '" data-toggle="tooltip" data-placement="top" title="' . /** @scrutinizer ignore-type */ trans('buttons.backend.access.users.confirm') . '" name="confirm_item"><label class="label label-danger" style="cursor:pointer">' . trans('labels.general.no') . '</label></a>';
Loading history...
Bug introduced by
Are you sure trans('labels.general.no') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

52
        return '<a href="' . route('admin.access.user.confirm', $this) . '" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.access.users.confirm') . '" name="confirm_item"><label class="label label-danger" style="cursor:pointer">' . /** @scrutinizer ignore-type */ trans('labels.general.no') . '</label></a>';
Loading history...
53
    }
54
55
    /**
56
     * @return mixed
57
     */
58
    public function getPictureAttribute()
59
    {
60
        return $this->getPicture();
61
    }
62
63
    /**
64
     * @param bool $size
65
     *
66
     * @return mixed
67
     */
68
    public function getPicture($size = false)
69
    {
70
        if (! $size) {
71
            $size = config('gravatar.default.size');
72
        }
73
74
        return gravatar()->get($this->email, ['size' => $size]);
0 ignored issues
show
Bug introduced by
array('size' => $size) of type array is incompatible with the type string expected by parameter $configGroup of Creativeorange\Gravatar\Gravatar::get(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

74
        return gravatar()->get($this->email, /** @scrutinizer ignore-type */ ['size' => $size]);
Loading history...
75
    }
76
77
    /**
78
     * @param $provider
79
     *
80
     * @return bool
81
     */
82
    public function hasProvider($provider)
83
    {
84
        foreach ($this->providers as $p) {
85
            if ($p->provider == $provider) {
86
                return true;
87
            }
88
        }
89
90
        return false;
91
    }
92
93
    /**
94
     * @return bool
95
     */
96
    public function isActive()
97
    {
98
        return $this->status == 1;
99
    }
100
101
    /**
102
     * @return bool
103
     */
104
    public function isConfirmed()
105
    {
106
        return $this->confirmed == 1;
107
    }
108
109
    /**
110
     * @return bool
111
     */
112
    public function isPending()
113
    {
114
        return config('access.users.requires_approval') && $this->confirmed == 0;
115
    }
116
117
    /**
118
     * @return string
119
     */
120
    public function getFullNameAttribute()
121
    {
122
        return $this->last_name
123
            ? $this->first_name . ' ' . $this->last_name
124
            : $this->first_name;
125
    }
126
127
    /**
128
     * @return string
129
     */
130
    public function getNameAttribute()
131
    {
132
        return $this->full_name;
133
    }
134
135
    /**
136
     * @return string
137
     */
138
    public function getShowButtonAttribute()
139
    {
140
        return '<a href="' . route('admin.access.user.show', $this) . '" class="btn btn-xs btn-info"><i class="fa fa-search" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.general.crud.view') . '"></i></a> ';
0 ignored issues
show
Bug introduced by
$this of type App\Models\Access\User\T...Attribute\UserAttribute is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

140
        return '<a href="' . route('admin.access.user.show', /** @scrutinizer ignore-type */ $this) . '" class="btn btn-xs btn-info"><i class="fa fa-search" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.general.crud.view') . '"></i></a> ';
Loading history...
Bug introduced by
Are you sure trans('buttons.general.crud.view') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

140
        return '<a href="' . route('admin.access.user.show', $this) . '" class="btn btn-xs btn-info"><i class="fa fa-search" data-toggle="tooltip" data-placement="top" title="' . /** @scrutinizer ignore-type */ trans('buttons.general.crud.view') . '"></i></a> ';
Loading history...
141
    }
142
143
    /**
144
     * @return string
145
     */
146
    public function getEditButtonAttribute()
147
    {
148
        return '<a href="' . route('admin.access.user.edit', $this) . '" class="btn btn-xs btn-primary"><i class="fa fa-pencil" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.general.crud.edit') . '"></i></a> ';
0 ignored issues
show
Bug introduced by
$this of type App\Models\Access\User\T...Attribute\UserAttribute is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

148
        return '<a href="' . route('admin.access.user.edit', /** @scrutinizer ignore-type */ $this) . '" class="btn btn-xs btn-primary"><i class="fa fa-pencil" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.general.crud.edit') . '"></i></a> ';
Loading history...
Bug introduced by
Are you sure trans('buttons.general.crud.edit') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

148
        return '<a href="' . route('admin.access.user.edit', $this) . '" class="btn btn-xs btn-primary"><i class="fa fa-pencil" data-toggle="tooltip" data-placement="top" title="' . /** @scrutinizer ignore-type */ trans('buttons.general.crud.edit') . '"></i></a> ';
Loading history...
149
    }
150
151
    /**
152
     * @return string
153
     */
154
    public function getChangePasswordButtonAttribute()
155
    {
156
        return '<a href="' . route('admin.access.user.change-password', $this) . '" class="btn btn-xs btn-info"><i class="fa fa-refresh" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.access.users.change_password') . '"></i></a> ';
0 ignored issues
show
Bug introduced by
$this of type App\Models\Access\User\T...Attribute\UserAttribute is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

156
        return '<a href="' . route('admin.access.user.change-password', /** @scrutinizer ignore-type */ $this) . '" class="btn btn-xs btn-info"><i class="fa fa-refresh" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.access.users.change_password') . '"></i></a> ';
Loading history...
Bug introduced by
Are you sure trans('buttons.backend.a...users.change_password') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

156
        return '<a href="' . route('admin.access.user.change-password', $this) . '" class="btn btn-xs btn-info"><i class="fa fa-refresh" data-toggle="tooltip" data-placement="top" title="' . /** @scrutinizer ignore-type */ trans('buttons.backend.access.users.change_password') . '"></i></a> ';
Loading history...
157
    }
158
159
    /**
160
     * @return string
161
     */
162
    public function getStatusButtonAttribute()
163
    {
164
        if ($this->id != access()->id()) {
165
            switch ($this->status) {
166
                case 0:
167
                    return '<a href="' . route('admin.access.user.mark', [
168
                        $this,
169
                        1,
170
                    ]) . '" class="btn btn-xs btn-success"><i class="fa fa-play" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.access.users.activate') . '"></i></a> ';
0 ignored issues
show
Bug introduced by
Are you sure trans('buttons.backend.access.users.activate') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

170
                    ]) . '" class="btn btn-xs btn-success"><i class="fa fa-play" data-toggle="tooltip" data-placement="top" title="' . /** @scrutinizer ignore-type */ trans('buttons.backend.access.users.activate') . '"></i></a> ';
Loading history...
171
                // No break
172
173
                case 1:
174
                    return '<a href="' . route('admin.access.user.mark', [
175
                        $this,
176
                        0,
177
                    ]) . '" class="btn btn-xs btn-warning"><i class="fa fa-pause" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.access.users.deactivate') . '"></i></a> ';
0 ignored issues
show
Bug introduced by
Are you sure trans('buttons.backend.access.users.deactivate') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

177
                    ]) . '" class="btn btn-xs btn-warning"><i class="fa fa-pause" data-toggle="tooltip" data-placement="top" title="' . /** @scrutinizer ignore-type */ trans('buttons.backend.access.users.deactivate') . '"></i></a> ';
Loading history...
178
                // No break
179
180
                default:
181
                    return '';
182
                // No break
183
            }
184
        }
185
186
        return '';
187
    }
188
189
    /**
190
     * @return string
191
     */
192
    public function getConfirmedButtonAttribute()
193
    {
194
        if (! $this->isConfirmed() && ! config('access.users.requires_approval')) {
195
            return '<a href="' . route('admin.access.user.account.confirm.resend', $this) . '" class="btn btn-xs btn-success"><i class="fa fa-refresh" data-toggle="tooltip" data-placement="top" title=' . trans('buttons.backend.access.users.resend_email') . '"></i></a> ';
0 ignored issues
show
Bug introduced by
$this of type App\Models\Access\User\T...Attribute\UserAttribute is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

195
            return '<a href="' . route('admin.access.user.account.confirm.resend', /** @scrutinizer ignore-type */ $this) . '" class="btn btn-xs btn-success"><i class="fa fa-refresh" data-toggle="tooltip" data-placement="top" title=' . trans('buttons.backend.access.users.resend_email') . '"></i></a> ';
Loading history...
Bug introduced by
Are you sure trans('buttons.backend.a...ss.users.resend_email') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

195
            return '<a href="' . route('admin.access.user.account.confirm.resend', $this) . '" class="btn btn-xs btn-success"><i class="fa fa-refresh" data-toggle="tooltip" data-placement="top" title=' . /** @scrutinizer ignore-type */ trans('buttons.backend.access.users.resend_email') . '"></i></a> ';
Loading history...
196
        }
197
198
        return '';
199
    }
200
201
    /**
202
     * @return string
203
     */
204
    public function getDeleteButtonAttribute()
205
    {
206
        if ($this->id != access()->id() && $this->id != 1) {
207
            return '<a href="' . route('admin.access.user.destroy', $this) . '"
0 ignored issues
show
Bug introduced by
$this of type App\Models\Access\User\T...Attribute\UserAttribute is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

207
            return '<a href="' . route('admin.access.user.destroy', /** @scrutinizer ignore-type */ $this) . '"
Loading history...
208
                 data-method="delete"
209
                 data-trans-button-cancel="' . trans('buttons.general.cancel') . '"
0 ignored issues
show
Bug introduced by
Are you sure trans('buttons.general.cancel') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

209
                 data-trans-button-cancel="' . /** @scrutinizer ignore-type */ trans('buttons.general.cancel') . '"
Loading history...
210
                 data-trans-button-confirm="' . trans('buttons.general.crud.delete') . '"
0 ignored issues
show
Bug introduced by
Are you sure trans('buttons.general.crud.delete') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

210
                 data-trans-button-confirm="' . /** @scrutinizer ignore-type */ trans('buttons.general.crud.delete') . '"
Loading history...
211
                 data-trans-title="' . trans('strings.backend.general.are_you_sure') . '"
0 ignored issues
show
Bug introduced by
Are you sure trans('strings.backend.general.are_you_sure') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

211
                 data-trans-title="' . /** @scrutinizer ignore-type */ trans('strings.backend.general.are_you_sure') . '"
Loading history...
212
                 class="btn btn-xs btn-danger"><i class="fa fa-trash" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.general.crud.delete') . '"></i></a> ';
213
        }
214
215
        return '';
216
    }
217
218
    /**
219
     * @return string
220
     */
221
    public function getRestoreButtonAttribute()
222
    {
223
        return '<a href="' . route('admin.access.user.restore', $this) . '" name="restore_user" class="btn btn-xs btn-info"><i class="fa fa-refresh" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.access.users.restore_user') . '"></i></a> ';
0 ignored issues
show
Bug introduced by
$this of type App\Models\Access\User\T...Attribute\UserAttribute is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

223
        return '<a href="' . route('admin.access.user.restore', /** @scrutinizer ignore-type */ $this) . '" name="restore_user" class="btn btn-xs btn-info"><i class="fa fa-refresh" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.access.users.restore_user') . '"></i></a> ';
Loading history...
Bug introduced by
Are you sure trans('buttons.backend.a...ss.users.restore_user') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

223
        return '<a href="' . route('admin.access.user.restore', $this) . '" name="restore_user" class="btn btn-xs btn-info"><i class="fa fa-refresh" data-toggle="tooltip" data-placement="top" title="' . /** @scrutinizer ignore-type */ trans('buttons.backend.access.users.restore_user') . '"></i></a> ';
Loading history...
224
    }
225
226
    /**
227
     * @return string
228
     */
229
    public function getDeletePermanentlyButtonAttribute()
230
    {
231
        return '<a href="' . route('admin.access.user.delete-permanently', $this) . '" name="delete_user_perm" class="btn btn-xs btn-danger"><i class="fa fa-trash" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.access.users.delete_permanently') . '"></i></a> ';
0 ignored issues
show
Bug introduced by
$this of type App\Models\Access\User\T...Attribute\UserAttribute is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

231
        return '<a href="' . route('admin.access.user.delete-permanently', /** @scrutinizer ignore-type */ $this) . '" name="delete_user_perm" class="btn btn-xs btn-danger"><i class="fa fa-trash" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.access.users.delete_permanently') . '"></i></a> ';
Loading history...
Bug introduced by
Are you sure trans('buttons.backend.a...rs.delete_permanently') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

231
        return '<a href="' . route('admin.access.user.delete-permanently', $this) . '" name="delete_user_perm" class="btn btn-xs btn-danger"><i class="fa fa-trash" data-toggle="tooltip" data-placement="top" title="' . /** @scrutinizer ignore-type */ trans('buttons.backend.access.users.delete_permanently') . '"></i></a> ';
Loading history...
232
    }
233
234
    /**
235
     * @return string
236
     */
237
    public function getLoginAsButtonAttribute()
238
    {
239
        /*
240
         * If the admin is currently NOT spoofing a user
241
         */
242
        if (! session()->has('admin_user_id') || ! session()->has('temp_user_id')) {
243
            //Won't break, but don't let them "Login As" themselves
244
            if ($this->id != access()->id()) {
245
                return '<a href="' . route('admin.access.user.login-as',
246
                    $this) . '" class="btn btn-xs btn-success"><i class="fa fa-lock" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.access.users.login_as',
0 ignored issues
show
Bug introduced by
$this of type App\Models\Access\User\T...Attribute\UserAttribute is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

246
                    /** @scrutinizer ignore-type */ $this) . '" class="btn btn-xs btn-success"><i class="fa fa-lock" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.access.users.login_as',
Loading history...
Bug introduced by
Are you sure trans('buttons.backend.a...' => $this->full_name)) of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

246
                    $this) . '" class="btn btn-xs btn-success"><i class="fa fa-lock" data-toggle="tooltip" data-placement="top" title="' . /** @scrutinizer ignore-type */ trans('buttons.backend.access.users.login_as',
Loading history...
247
                    ['user' => $this->full_name]) . '"></i></a> ';
248
            }
249
        }
250
251
        return '';
252
    }
253
254
    /**
255
     * @return string
256
     */
257
    public function getClearSessionButtonAttribute()
258
    {
259
        if ($this->id != access()->id() && config('session.driver') == 'database') {
260
            return '<a href="' . route('admin.access.user.clear-session', $this) . '"
0 ignored issues
show
Bug introduced by
$this of type App\Models\Access\User\T...Attribute\UserAttribute is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

260
            return '<a href="' . route('admin.access.user.clear-session', /** @scrutinizer ignore-type */ $this) . '"
Loading history...
261
			 	 data-trans-button-cancel="' . trans('buttons.general.cancel') . '"
0 ignored issues
show
Bug introduced by
Are you sure trans('buttons.general.cancel') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

261
			 	 data-trans-button-cancel="' . /** @scrutinizer ignore-type */ trans('buttons.general.cancel') . '"
Loading history...
262
                 data-trans-button-confirm="' . trans('buttons.general.continue') . '"
0 ignored issues
show
Bug introduced by
Are you sure trans('buttons.general.continue') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

262
                 data-trans-button-confirm="' . /** @scrutinizer ignore-type */ trans('buttons.general.continue') . '"
Loading history...
263
                 data-trans-title="' . trans('strings.backend.general.are_you_sure') . '"
0 ignored issues
show
Bug introduced by
Are you sure trans('strings.backend.general.are_you_sure') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

263
                 data-trans-title="' . /** @scrutinizer ignore-type */ trans('strings.backend.general.are_you_sure') . '"
Loading history...
264
                 class="btn btn-xs btn-warning" name="confirm_item"><i class="fa fa-times" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.access.users.clear_session') . '"></i></a> ';
0 ignored issues
show
Bug introduced by
Are you sure trans('buttons.backend.a...s.users.clear_session') of type null|string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

264
                 class="btn btn-xs btn-warning" name="confirm_item"><i class="fa fa-times" data-toggle="tooltip" data-placement="top" title="' . /** @scrutinizer ignore-type */ trans('buttons.backend.access.users.clear_session') . '"></i></a> ';
Loading history...
265
        }
266
267
        return '';
268
    }
269
270
    /**
271
     * @return string
272
     */
273
    public function getActionButtonsAttribute()
274
    {
275
        if ($this->trashed()) {
0 ignored issues
show
Bug introduced by
It seems like trashed() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

275
        if ($this->/** @scrutinizer ignore-call */ trashed()) {
Loading history...
276
            return $this->restore_button . $this->delete_permanently_button;
277
        }
278
279
        return
280
            $this->clear_session_button .
281
            $this->login_as_button .
282
            $this->show_button .
283
            $this->edit_button .
284
            $this->change_password_button .
285
            $this->status_button .
286
            $this->confirmed_button .
287
            $this->delete_button;
288
    }
289
}
290