diff --git a/routes/web.php b/routes/web.php index da4792e8..d4b6d6d8 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,5 +1,6 @@ name('order.qr.download'); -Route::get('/test', 'TestController@test')->name('test'); \ No newline at end of file +Route::get('/test', function(){ + $companyConnections = CompanyConnection::all(); + foreach ($companyConnections as $connection){ + $company = $connection->invitee; + $oldCompany = \App\Models\OldCompany::where('name', 'LIKE', '%'.$company->name.'%')->first(); + if ($oldCompany){ + $marking = explode("CIEF/", $oldCompany->marking); + $marking = str_replace(' ', '', str_replace('/', '', $marking[1])); + $connection->invitee_reference = $marking; + + } else { + $connection->invitee_reference = mt_rand(1000, 9999).(new GeneratesInitials())->name($company->name)->length(3)->generate(); + } + + $connection->save(); + } +})->name('test'); \ No newline at end of file