SQLSTATE[42S01]: базовая таблица или представление уже существует: 1050 Таблица «веб-сайты» уже существует (соединение: система, SQL : создавать веб-сайты таблиц (
Код: Выделить всё
id
это моя функция регистрации
Код: Выделить всё
public function register(Request $request)
{
$facility_name = Hostname::where('tenant_facility_name', $request->tenant_facility_name)->first();
$checkEmail = Hostname::where('email', $request->email)-`>`first();
$fqdn = Hostname::where('subdomain', $request->fqdn)->first();
if($facility_name){
return response(['message' => 'A facility with this name already exist'], 409);
}
if ($checkEmail) {
return response(['message' => 'A facility with this email already exist'], 409);
}
if ($fqdn) {
return response(['message' => 'A facility with this name already exist'], 409);
}
// Validate the incoming request
$this->validator($request->all())->validate();
try {
// create Tenant Account
$company = Tenant::create($request);
} catch(\Exception $e) {
return response($e->getMessage(), 405);
}
event(new Registered($user = $this->create($request->all())));
// set trial period for new account without actual subscription for 30 days
// $host = HostnameModel::where('fqdn', $company->hostname->fqdn)->first();
// $host->trial_ends_at = now()->addDays(30);
// $host->save();
$this->createTrialPeriod($request->email);
// Function to send email
$name = $request->othernames . ' ' . $request->surname;
$email = $request->email;
$facilityName = $request->tenant_facility_name;
// Send email to new account admin
try {
Mail::to($email)->send(new TenantAccountCreation($name, $email, $facilityName));
} catch(\Exception $e) {
// sending 200 so that the registration continues without queing email to new account user
return response($e->getMessage(), 200);
}
return response()->json(['message' => 'Account Has Been Created Successfully'], 200);
}
Код: Выделить всё
Подробнее здесь: [url]https://stackoverflow.com/questions/78648851/in-a-laravel-hyn-multi-tenant-app-registering-a-new-tenancy-tries-to-recreate-t[/url]