2021-03-22 21:09:42 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2023-01-28 23:21:40 +01:00
|
|
|
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
|
2021-03-22 21:09:42 +01:00
|
|
|
*
|
2021-06-16 08:58:16 +02:00
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
2021-03-22 21:09:42 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use App\Libraries\MultiDB;
|
|
|
|
|
|
|
|
class SubdomainController extends BaseController
|
|
|
|
{
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-06-07 03:21:26 +02:00
|
|
|
* Return if a subdomain is available.
|
2021-03-22 21:09:42 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
public function index()
|
|
|
|
{
|
2023-06-07 03:21:26 +02:00
|
|
|
if (!MultiDB::checkDomainAvailable(request()->input('subdomain'))) {
|
2022-06-21 11:57:17 +02:00
|
|
|
return response()->json(['message' => 'Domain not available'], 401);
|
|
|
|
}
|
2021-03-22 21:09:42 +01:00
|
|
|
|
|
|
|
return response()->json(['message' => 'Domain available'], 200);
|
|
|
|
}
|
|
|
|
}
|