| Server IP : 46.62.235.243 / Your IP : 216.73.216.217 Web Server : Apache/2.4.58 (Ubuntu) System : Linux Linkabili3Dicembre 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/linkabili/app/Console/Commands/ |
Upload File : |
<?php
namespace App\Console\Commands;
require_once 'app/Helpers/helper.php';
use App\ChMessage;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Mail;
use App\User;
use App\Models\UserDetail;
use Illuminate\Support\Str;
use App\Models\City;
use App\Models\State;
use App\Http\Controllers\Auth\RegisterController;
class DetectCities extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'linkabili:DetectCities';
/**
* The console command description.
*
* @var string
*/
protected $description = "Command detect cities";
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
UserDetail::all()->each(function ($user) {
if ($user->city) {
$city = City::where('nome', 'like', $user->city)->first();
if ($city) {
$user->city_id = $city->id;
$user->save();
}
}
});
}
}