Code Duplication    Length = 17-17 lines in 2 locations

src/Http/Controllers/InventoryController.php 1 location

@@ 135-151 (lines=17) @@
132
     *
133
     * @return \Illuminate\Http\Response
134
     */
135
    public function update(Request $request, $id)
136
    {
137
        $inventory = Inventory::findOrFail($id);
138
        $this->validateInput($request);
139
        // Upload image
140
        $keys = ['name', 'description', 'material_type_id', 'brand_id', 'model_id', 'location_id', 'quantity',
141
        'price', 'moneysourceId', 'provider_id', 'date_entrance', 'last_update', ];
142
        $input = $this->createQueryInput($keys, $request);
143
        if ($request->file('picture')) {
144
            $path = $request->file('picture')->store('public');
145
            $input['picture'] = $path;
146
        }
147
        Inventory::where('id', $id)
148
            ->update($input);
149
150
        return redirect()->intended('/inventory-mnt');
151
    }
152
153
    /**
154
     * Remove the specified resource from storage.

src/Models/InventoryController.php 1 location

@@ 136-152 (lines=17) @@
133
     *
134
     * @return \Illuminate\Http\Response
135
     */
136
    public function update(Request $request, $id)
137
    {
138
        $inventory = Inventory::findOrFail($id);
139
        $this->validateInput($request);
140
        // Upload image
141
        $keys = ['name', 'description', 'material_type_id', 'brand_id', 'model_id', 'location_id', 'quantity',
142
        'price', 'moneysourceId', 'provider_id', 'date_entrance', 'last_update', ];
143
        $input = $this->createQueryInput($keys, $request);
144
        if ($request->file('picture')) {
145
            $path = $request->file('picture')->store('public');
146
            $input['picture'] = $path;
147
        }
148
        Inventory::where('id', $id)
149
            ->update($input);
150
151
        return redirect()->intended('/inventory-mnt');
152
    }
153
154
    /**
155
     * Remove the specified resource from storage.