diff --git a/app/Http/Controllers/ControlController.php b/app/Http/Controllers/ControlController.php index 4c5b1841..440bf736 100644 --- a/app/Http/Controllers/ControlController.php +++ b/app/Http/Controllers/ControlController.php @@ -1555,14 +1555,19 @@ public function accept() // create a new control $new_control = $control->replicate(); + $new_control->status = 0; $new_control->observations = null; $new_control->realisation_date = null; $new_control->note = null; $new_control->score = null; $new_control->plan_date = request('next_date'); + // Save new control $new_control->save(); + // Clone measures + $new_control->measures()->sync($control->measures->pluck('id')->toArray()); + // Set owners $new_control->owners()->sync($control->owners->pluck('id')->toArray()); diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 089ec272..5db16c29 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -12,16 +12,12 @@ class DatabaseSeeder extends Seeder */ public function run() { - $lang = env('LANG', 1); - if ($lang===null) - $lang="en"; - DB::table('users')->insert([ 'login' => 'admin', 'name' => 'Administrator', 'title' => 'Pirate Captain', 'role' => 1, - 'language' => $lang, + 'language' => 'en', 'email' => 'admin@admin.localhost', 'password' => bcrypt('admin'), ]);