Code Duplication    Length = 7-7 lines in 2 locations

routes/generator.php 2 locations

@@ 39-45 (lines=7) @@
36
        json_encode($request->except('models'), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
37
38
    // Generate json for models
39
    foreach ($models['models'] as $model)
40
    {
41
        $modelName = $model['modelName'];
42
        array_shift($model);
43
        File::put(base_path('scaffolder-config/models/' . $modelName . '.json'),
44
            json_encode($model, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
45
    }
46
});
47
48
Route::post('scaffolder/generate-and-execute', function (Request $request)
@@ 63-69 (lines=7) @@
60
        json_encode($request->except('models'), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
61
62
    // Generate json for models
63
    foreach ($models['models'] as $model)
64
    {
65
        $modelName = $model['modelName'];
66
        array_shift($model);
67
        File::put(base_path('scaffolder-config/models/' . $modelName . '.json'),
68
            json_encode($model, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
69
    }
70
71
    // Execute artisan command
72
    $exitCode = Artisan::call('mpaleo.scaffolder:generate');