@@ -11,7 +11,7 @@ |
||
| 11 | 11 | public function handle($command) |
| 12 | 12 | { |
| 13 | 13 | $command->info('Migrating Topic...'); |
| 14 | - $this->table('topic')->orderBy('tid', 'asc')->chunk(100, function ($items) { |
|
| 14 | + $this->table('topic')->orderBy('tid', 'asc')->chunk(100, function($items) { |
|
| 15 | 15 | foreach ($items as $item) { |
| 16 | 16 | $this->transform($item); |
| 17 | 17 | } |
@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | public function handle($command) |
| 12 | 12 | { |
| 13 | 13 | $command->info('Migrating Contest...'); |
| 14 | - $this->table('contest')->orderBy('contest_id', 'asc')->chunk(100, function ($objects) { |
|
| 15 | - $objects->map(function ($object) { |
|
| 14 | + $this->table('contest')->orderBy('contest_id', 'asc')->chunk(100, function($objects) { |
|
| 15 | + $objects->map(function($object) { |
|
| 16 | 16 | $this->transform($object); |
| 17 | 17 | }); |
| 18 | 18 | }); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $perm = 'c'.$contest->id; |
| 65 | 65 | $perms = $this->table('privilege')->where('rightstr', $perm)->distinct('user_id')->get(); |
| 66 | 66 | |
| 67 | - $perms->map(function ($perm) use ($contest) { |
|
| 67 | + $perms->map(function($perm) use ($contest) { |
|
| 68 | 68 | /** @var User $user */ |
| 69 | 69 | $user = app(UserService::class)->findByName($perm->user_id); |
| 70 | 70 | $contest->users()->attach($user); |
@@ -10,8 +10,8 @@ |
||
| 10 | 10 | public function handle($command) |
| 11 | 11 | { |
| 12 | 12 | $command->info('Migrating Articles...'); |
| 13 | - $this->table('news')->orderBy('news_id', 'asc')->chunk(100, function ($objects) { |
|
| 14 | - $objects->map(function ($object) { |
|
| 13 | + $this->table('news')->orderBy('news_id', 'asc')->chunk(100, function($objects) { |
|
| 14 | + $objects->map(function($object) { |
|
| 15 | 15 | $this->transformArticle($object); |
| 16 | 16 | }); |
| 17 | 17 | }); |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | public function handle($command) |
| 10 | 10 | { |
| 11 | 11 | $command->info('Migrating Users...'); |
| 12 | - $this->table('users')->orderBy('reg_time', 'asc')->chunk(100, function ($objects) { |
|
| 12 | + $this->table('users')->orderBy('reg_time', 'asc')->chunk(100, function($objects) { |
|
| 13 | 13 | foreach ($objects as $object) { |
| 14 | 14 | $this->transform($object); |
| 15 | 15 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | public function handle($command) |
| 16 | 16 | { |
| 17 | 17 | $command->info('Migrating Login Logs...'); |
| 18 | - User::chunk(100, function ($users) { |
|
| 18 | + User::chunk(100, function($users) { |
|
| 19 | 19 | foreach ($users as $user) { |
| 20 | 20 | $this->processUser($user); |
| 21 | 21 | } |
@@ -13,25 +13,25 @@ |
||
| 13 | 13 | public function handle($command) |
| 14 | 14 | { |
| 15 | 15 | $command->info('Migrating Solutions...'); |
| 16 | - $this->table('solution')->orderBy('solution_id', 'asc')->chunk(100, function ($objects) { |
|
| 16 | + $this->table('solution')->orderBy('solution_id', 'asc')->chunk(100, function($objects) { |
|
| 17 | 17 | foreach ($objects as $object) { |
| 18 | 18 | $this->transformSolution($object); |
| 19 | 19 | } |
| 20 | 20 | }); |
| 21 | 21 | $command->info('Migrating Runtime Info...'); |
| 22 | - $this->table('runtimeinfo')->orderBy('solution_id', 'asc')->chunk(100, function ($objects) { |
|
| 22 | + $this->table('runtimeinfo')->orderBy('solution_id', 'asc')->chunk(100, function($objects) { |
|
| 23 | 23 | foreach ($objects as $object) { |
| 24 | 24 | $this->transformRuntimeInfo($object); |
| 25 | 25 | } |
| 26 | 26 | }); |
| 27 | 27 | $command->info('Migrating Compile Info...'); |
| 28 | - $this->table('compileinfo')->orderBy('solution_id', 'asc')->chunk(100, function ($objects) { |
|
| 28 | + $this->table('compileinfo')->orderBy('solution_id', 'asc')->chunk(100, function($objects) { |
|
| 29 | 29 | foreach ($objects as $object) { |
| 30 | 30 | $this->transformCompileInfo($object); |
| 31 | 31 | } |
| 32 | 32 | }); |
| 33 | 33 | $command->info('Migrating Source Code...'); |
| 34 | - $this->table('source_code')->orderBy('solution_id', 'asc')->chunk(100, function ($objects) { |
|
| 34 | + $this->table('source_code')->orderBy('solution_id', 'asc')->chunk(100, function($objects) { |
|
| 35 | 35 | foreach ($objects as $object) { |
| 36 | 36 | $this->transformSource($object); |
| 37 | 37 | } |
@@ -9,8 +9,8 @@ |
||
| 9 | 9 | public function handle($command) |
| 10 | 10 | { |
| 11 | 11 | $command->info('Migrating Problems...'); |
| 12 | - $this->table('problem')->orderBy('problem_id', 'asc')->chunk(100, function ($objects) { |
|
| 13 | - $objects->map(function ($object) { |
|
| 12 | + $this->table('problem')->orderBy('problem_id', 'asc')->chunk(100, function($objects) { |
|
| 13 | + $objects->map(function($object) { |
|
| 14 | 14 | $this->transform($object); |
| 15 | 15 | }); |
| 16 | 16 | }); |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | $model->access = $model->lastAccess->first(); |
| 37 | 37 | $model->addHidden('lastAccess'); |
| 38 | 38 | |
| 39 | - $model->roles_edit = $model->roles->map(function ($role) { |
|
| 39 | + $model->roles_edit = $model->roles->map(function($role) { |
|
| 40 | 40 | return $role->id; |
| 41 | 41 | }); |
| 42 | 42 | $model->addHidden('roles'); |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | */ |
| 67 | 67 | protected function updateOrSave($model) |
| 68 | 68 | { |
| 69 | - app('db')->transaction(function () use ($model) { |
|
| 69 | + app('db')->transaction(function() use ($model) { |
|
| 70 | 70 | $attrs = request()->except(['start_time', 'end_time']); |
| 71 | 71 | $model->fill($attrs); |
| 72 | 72 | $model->start_time = Carbon::parse(request('start_time')); |