Code Duplication    Length = 10-10 lines in 2 locations

app/Models/User.php 1 location

@@ 200-209 (lines=10) @@
197
     * @param  bool  $withTrashed
198
     * @return \Illuminate\Support\Collection
199
     */
200
    public function getDevices($withTrashed = false)
201
    {
202
        return Device::whereIn('id', function ($query) use ($withTrashed) {
203
            $query->select('device_id')->from('user_devices')->where('user_id', $this->id);
204
205
            if (! $withTrashed) {
206
                $query->where('deleted_at', null);
207
            }
208
        })->get();
209
    }
210
}
211

app/Models/Device.php 1 location

@@ 236-245 (lines=10) @@
233
     * @param  bool  $withTrashed
234
     * @return \Illuminate\Support\Collection
235
     */
236
    public function getUsers($withTrashed = false)
237
    {
238
        return User::whereIn('id', function ($query) use ($withTrashed) {
239
            $query->select('user_id')->from('user_devices')->where('device_id', $this->id);
240
241
            if (! $withTrashed) {
242
                $query->where('deleted_at', null);
243
            }
244
        })->get();
245
    }
246
}
247