mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-25 09:00:27 +00:00
Update DomainsController.php
This commit is contained in:
parent
93e54f8a72
commit
5b6e4e1b98
1 changed files with 20 additions and 1 deletions
|
@ -83,7 +83,26 @@ class DomainsController extends ApiController
|
||||||
$findDomain = Domain::where('id', $id)->first();
|
$findDomain = Domain::where('id', $id)->first();
|
||||||
if ($findDomain) {
|
if ($findDomain) {
|
||||||
|
|
||||||
if (!empty($request->domain)) {
|
if (!empty($request->domain) && $request->domain != $findDomain->domain) {
|
||||||
|
|
||||||
|
$findNewDomainNameIfExist = Domain::where('domain', $request->domain)->first();
|
||||||
|
if ($findNewDomainNameIfExist) {
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => 'Domain already exist',
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
$findHostingSubscription = HostingSubscription::where('id', $findDomain->hosting_subscription_id)->first();
|
||||||
|
if (!$findHostingSubscription) {
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => 'Hosting subscription not found',
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$findHostingSubscription->domain = $request->domain;
|
||||||
|
$findHostingSubscription->save();
|
||||||
|
|
||||||
$findDomain->domain = $request->domain;
|
$findDomain->domain = $request->domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue