Code Duplication    Length = 8-10 lines in 2 locations

src/Modules/Core/BaseClasses/BaseRepository.php 2 locations

@@ 437-444 (lines=8) @@
434
    public function delete($value, $attribute = 'id')
435
    {
436
        if ($attribute == 'id') {
437
            \DB::transaction(function () use ($value) {
438
                $model = $this->model->lockForUpdate()->find($value);
439
                if (! $model) {
440
                    \ErrorHandler::notFound(class_basename($this->model).' with id : '.$value);
441
                }
442
                
443
                $model->delete();
444
            });
445
        } else {
446
            \DB::transaction(function () use ($value, $attribute) {
447
                $this->model->where($attribute, '=', $value)->lockForUpdate()->get()->each(function ($model) {
@@ 531-540 (lines=10) @@
528
     * @param  integer $id
529
     * @return void
530
     */
531
    public function restore($id)
532
    {
533
        $model = $this->model->onlyTrashed()->find($id);
534
535
        if (! $model) {
536
            \ErrorHandler::notFound(class_basename($this->model).' with id : '.$id);
537
        }
538
539
        $model->restore();
540
    }
541
542
    /**
543
     * Build the conditions recursively for the retrieving methods.