Файловый менеджер - Редактировать - /home/clickysoft/public_html/calvary-p2.clickysoft.net/app/Console/Commands/UpdateUserNames.php
Назад
<?php namespace App\Console\Commands; use App\Models\User; use Illuminate\Console\Command; use Illuminate\Log\Logger; class UpdateUserNames extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'app:update-user-names'; /** * The console command description. * * @var string */ protected $description = 'Split full name into first name and last name of existing users'; /** * Execute the console command. */ public function handle() { $users = User::all(); $this->info('Starting process...'); $this->info('Updating user names...'); foreach ($users as $user) { $name = explode(' ', $user->full_name); $user->first_name = $name[0]; if (isset($name[1])) { $user->last_name = $name[1]; } $user->save(); } $this->info('Process completed successfully.'); } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка