Code Duplication    Length = 25-27 lines in 2 locations

app/Http/Controllers/Customers/CustomerFilesController.php 1 location

@@ 91-115 (lines=25) @@
88
    }
89
90
    //  Get the files for the customer
91
    public function show($id)
92
    {
93
        Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name);
94
95
        $files = CustomerFiles::where('cust_id', $id)
96
            ->with('Files')
97
            ->with('CustomerFileTypes')
98
            ->with('User')
99
            ->get();
100
101
        //  Determine if there is a parent site with shared files
102
        $parent = Customers::find($id)->parent_id;
103
        if($parent) {
104
            $parentList = Customerfiles::where('cust_id', $parent)
105
                ->where('shared', 1)
106
                ->with('Files')
107
                ->with('CustomerFileTypes')
108
                ->with('User')
109
                ->get();
110
111
            $files = $files->merge($parentList);
112
        }
113
114
        return $files;
115
    }
116
117
    //  Update the information of the file, but not the file itself
118
    public function update(Request $request, $id)

app/Http/Controllers/Customers/CustomerSystemsController.php 1 location

@@ 77-103 (lines=27) @@
74
    }
75
76
    //  Get the list of systems attached to the customer
77
    public function show($id)
78
    {
79
        Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name);
80
81
        $sysList = CustomerSystems::where('cust_id', $id)
82
                    ->with('SystemTypes')
83
                    ->with('SystemDataFields')
84
                    ->with('SystemDataFields.SystemDataFieldTypes')
85
                    ->orderBy('cust_sys_id', 'DESC')
86
                    ->get();
87
88
        //  determine if there is a parent site with shared systems
89
        $parent = Customers::findOrFail($id)->parent_id;
90
        if($parent != null)
91
        {
92
            $parentList = CustomerSystems::where('cust_id', $parent)
93
                                ->where('shared', 1)
94
                                ->with('SystemTypes')
95
                                ->with('SystemDataFields')
96
                                ->with('SystemDataFields.SystemDataFieldTypes')
97
                                ->get();
98
99
            $sysList = $sysList->merge($parentList);
100
        }
101
102
        return $sysList;
103
    }
104
105
    // Update the customers system data
106
    public function update(Request $request, $id)