mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Subdomain checks for hosted
This commit is contained in:
parent
dd46e6384a
commit
0d44249f41
39
app/Http/Controllers/SubdomainController.php
Normal file
39
app/Http/Controllers/SubdomainController.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
|
|
||||||
|
class SubdomainController extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$subdomain_exists = MultiDB::findAndSetDbByDomain(request()->input('subdomain'));
|
||||||
|
|
||||||
|
if($subdomain_exists)
|
||||||
|
return response()->json(['message' => 'Domain not available'] , 401);
|
||||||
|
|
||||||
|
return response()->json(['message' => 'Domain available'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -24,6 +24,7 @@ Route::group(['middleware' => ['api_secret_check', 'email_db']], function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'api/v1', 'as' => 'api.'], function () {
|
Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'api/v1', 'as' => 'api.'], function () {
|
||||||
|
Route::post('check_subdomain', 'SubdomainController@index')->name('check_subdomain');
|
||||||
Route::get('ping', 'PingController@index')->name('ping');
|
Route::get('ping', 'PingController@index')->name('ping');
|
||||||
Route::get('health_check', 'PingController@health')->name('health_check');
|
Route::get('health_check', 'PingController@health')->name('health_check');
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user