Merge pull request #268 from ControlPanel-gg/product_linking
Product linking
This commit is contained in:
commit
0d06b7e6db
|
@ -11,10 +11,11 @@ use Exception;
|
||||||
use Illuminate\Http\Client\PendingRequest;
|
use Illuminate\Http\Client\PendingRequest;
|
||||||
use Illuminate\Http\Client\Response;
|
use Illuminate\Http\Client\Response;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use Illuminate\Validation\Validator;
|
|
||||||
|
|
||||||
class Pterodactyl
|
class Pterodactyl
|
||||||
{
|
{
|
||||||
|
//TODO: Extend error handling (maybe logger for more errors when debugging)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return PendingRequest
|
* @return PendingRequest
|
||||||
*/
|
*/
|
||||||
|
@ -27,18 +28,67 @@ class Pterodactyl
|
||||||
])->baseUrl(env('PTERODACTYL_URL') . '/api');
|
])->baseUrl(env('PTERODACTYL_URL') . '/api');
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Extend error handling (maybe logger for more errors when debugging)
|
|
||||||
/**
|
/**
|
||||||
* Get user by pterodactyl id
|
* @return Exception
|
||||||
* @param int $pterodactylId
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function getUser(int $pterodactylId)
|
private static function getException(): Exception
|
||||||
{
|
{
|
||||||
$response = self::client()->get("/application/users/{$pterodactylId}");
|
return new Exception('Request Failed, is pterodactyl set-up correctly?');
|
||||||
|
}
|
||||||
|
|
||||||
if ($response->failed()) return $response->json();
|
/**
|
||||||
return $response->json()['attributes'];
|
* @param Nest $nest
|
||||||
|
* @return mixed
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static function getEggs(Nest $nest)
|
||||||
|
{
|
||||||
|
$response = self::client()->get("/application/nests/{$nest->id}/eggs?include=nest,variables");
|
||||||
|
if ($response->failed()) throw self::getException();
|
||||||
|
return $response->json()['data'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static function getNodes()
|
||||||
|
{
|
||||||
|
$response = self::client()->get('/application/nodes');
|
||||||
|
if ($response->failed()) throw self::getException();
|
||||||
|
return $response->json()['data'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return null
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static function getNests()
|
||||||
|
{
|
||||||
|
$response = self::client()->get('/application/nests');
|
||||||
|
if ($response->failed()) throw self::getException();
|
||||||
|
return $response->json()['data'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static function getLocations()
|
||||||
|
{
|
||||||
|
$response = self::client()->get('/application/locations');
|
||||||
|
if ($response->failed()) throw self::getException();
|
||||||
|
return $response->json()['data'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Node $node
|
||||||
|
* @return mixed
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static function getFreeAllocationId(Node $node)
|
||||||
|
{
|
||||||
|
return self::getFreeAllocations($node)[0]['attributes']['id'] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,66 +112,9 @@ class Pterodactyl
|
||||||
return $freeAllocations;
|
return $freeAllocations;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return null
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static function getNests()
|
|
||||||
{
|
|
||||||
$response = self::client()->get('/application/nests');
|
|
||||||
if ($response->failed()) throw self::getException();
|
|
||||||
return $response->json()['data'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Nest $nest
|
|
||||||
* @return mixed
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static function getEggs(Nest $nest)
|
|
||||||
{
|
|
||||||
$response = self::client()->get("/application/nests/{$nest->id}/eggs?include=nest,variables");
|
|
||||||
if ($response->failed()) throw self::getException();
|
|
||||||
return $response->json()['data'];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static function getNodes()
|
|
||||||
{
|
|
||||||
$response = self::client()->get('/application/nodes');
|
|
||||||
if ($response->failed()) throw self::getException();
|
|
||||||
return $response->json()['data'];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static function getLocations()
|
|
||||||
{
|
|
||||||
$response = self::client()->get('/application/locations');
|
|
||||||
if ($response->failed()) throw self::getException();
|
|
||||||
return $response->json()['data'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Node $node
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public static function getFreeAllocationId(Node $node)
|
|
||||||
{
|
|
||||||
|
|
||||||
return self::getFreeAllocations($node)[0]['attributes']['id'] ?? null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Node $node
|
* @param Node $node
|
||||||
|
* @return array|mixed
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function getAllocations(Node $node)
|
public static function getAllocations(Node $node)
|
||||||
|
@ -132,7 +125,6 @@ class Pterodactyl
|
||||||
return $response->json();
|
return $response->json();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param String $route
|
* @param String $route
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -174,6 +166,7 @@ class Pterodactyl
|
||||||
"default" => $allocationId
|
"default" => $allocationId
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function suspendServer(Server $server)
|
public static function suspendServer(Server $server)
|
||||||
|
@ -191,10 +184,15 @@ class Pterodactyl
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Exception
|
* Get user by pterodactyl id
|
||||||
|
* @param int $pterodactylId
|
||||||
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
private static function getException(): Exception
|
public function getUser(int $pterodactylId)
|
||||||
{
|
{
|
||||||
return new Exception('Request Failed, is pterodactyl set-up correctly?');
|
$response = self::client()->get("/application/users/{$pterodactylId}");
|
||||||
|
|
||||||
|
if ($response->failed()) return $response->json();
|
||||||
|
return $response->json()['attributes'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,11 @@ use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* Class NestsController
|
||||||
|
* @package App\Http\Controllers\Admin
|
||||||
|
*/
|
||||||
class NestsController extends Controller
|
class NestsController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,6 +14,11 @@ use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* Class NodeController
|
||||||
|
* @package App\Http\Controllers\Admin
|
||||||
|
*/
|
||||||
class NodeController extends Controller
|
class NodeController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
64
app/Http/Controllers/Admin/OverViewController.php
Normal file
64
app/Http/Controllers/Admin/OverViewController.php
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Egg;
|
||||||
|
use App\Models\Location;
|
||||||
|
use App\Models\Nest;
|
||||||
|
use App\Models\Node;
|
||||||
|
use App\Models\Payment;
|
||||||
|
use App\Models\Server;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
|
||||||
|
class OverViewController extends Controller
|
||||||
|
{
|
||||||
|
public const TTL = 86400;
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$userCount = Cache::remember('user:count', self::TTL, function () {
|
||||||
|
return User::query()->count();
|
||||||
|
});
|
||||||
|
|
||||||
|
$creditCount = Cache::remember('credit:count', self::TTL, function () {
|
||||||
|
return User::query()->sum('credits');
|
||||||
|
});
|
||||||
|
|
||||||
|
$paymentCount = Cache::remember('payment:count', self::TTL, function () {
|
||||||
|
return Payment::query()->count();
|
||||||
|
});
|
||||||
|
|
||||||
|
$serverCount = Cache::remember('server:count', self::TTL, function () {
|
||||||
|
return Server::query()->count();
|
||||||
|
});
|
||||||
|
|
||||||
|
$lastEgg = Egg::query()->latest('updated_at')->first();
|
||||||
|
$syncLastUpdate = $lastEgg ? $lastEgg->updated_at->isoFormat('LLL') : __('unknown');
|
||||||
|
|
||||||
|
return view('admin.overview.index', [
|
||||||
|
'serverCount' => $serverCount,
|
||||||
|
'userCount' => $userCount,
|
||||||
|
'paymentCount' => $paymentCount,
|
||||||
|
'creditCount' => number_format($creditCount, 2, '.', ''),
|
||||||
|
|
||||||
|
'locationCount' => Location::query()->count(),
|
||||||
|
'nodeCount' => Node::query()->count(),
|
||||||
|
'nestCount' => Nest::query()->count(),
|
||||||
|
'eggCount' => Egg::query()->count(),
|
||||||
|
'syncLastUpdate' => $syncLastUpdate
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description Sync locations,nodes,nests,eggs with the linked pterodactyl panel
|
||||||
|
*/
|
||||||
|
public function syncPterodactyl()
|
||||||
|
{
|
||||||
|
Node::syncNodes();
|
||||||
|
Egg::syncEggs();
|
||||||
|
|
||||||
|
return redirect()->back()->with('success', __('Pterodactyl synced'));
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,10 @@
|
||||||
namespace App\Http\Controllers\Admin;
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Egg;
|
||||||
|
use App\Models\Location;
|
||||||
|
use App\Models\Nest;
|
||||||
|
use App\Models\Node;
|
||||||
use App\Models\Configuration;
|
use App\Models\Configuration;
|
||||||
use App\Models\Product;
|
use App\Models\Product;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
@ -33,7 +37,18 @@ class ProductController extends Controller
|
||||||
*/
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
return view('admin.products.create');
|
return view('admin.products.create' , [
|
||||||
|
'locations' => Location::with('nodes')->get(),
|
||||||
|
'nests' => Nest::with('eggs')->get(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function clone(Request $request , Product $product){
|
||||||
|
return view('admin.products.create' , [
|
||||||
|
'product' => $product,
|
||||||
|
'locations' => Location::with('nodes')->get(),
|
||||||
|
'nests' => Nest::with('eggs')->get(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,11 +72,17 @@ class ProductController extends Controller
|
||||||
"databases" => "required|numeric|max:1000000|min:0",
|
"databases" => "required|numeric|max:1000000|min:0",
|
||||||
"backups" => "required|numeric|max:1000000|min:0",
|
"backups" => "required|numeric|max:1000000|min:0",
|
||||||
"allocations" => "required|numeric|max:1000000|min:0",
|
"allocations" => "required|numeric|max:1000000|min:0",
|
||||||
|
"nodes.*" => "required|exists:nodes,id",
|
||||||
|
"eggs.*" => "required|exists:eggs,id",
|
||||||
"disabled" => "nullable",
|
"disabled" => "nullable",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$disabled = !is_null($request->input('disabled'));
|
$disabled = !is_null($request->input('disabled'));
|
||||||
Product::create(array_merge($request->all(), ['disabled' => $disabled]));
|
$product = Product::create(array_merge($request->all(), ['disabled' => $disabled]));
|
||||||
|
|
||||||
|
#link nodes and eggs
|
||||||
|
$product->eggs()->attach($request->input('eggs'));
|
||||||
|
$product->nodes()->attach($request->input('nodes'));
|
||||||
|
|
||||||
return redirect()->route('admin.products.index')->with('success', 'product has been created!');
|
return redirect()->route('admin.products.index')->with('success', 'product has been created!');
|
||||||
}
|
}
|
||||||
|
@ -89,7 +110,9 @@ class ProductController extends Controller
|
||||||
public function edit(Product $product)
|
public function edit(Product $product)
|
||||||
{
|
{
|
||||||
return view('admin.products.edit', [
|
return view('admin.products.edit', [
|
||||||
'product' => $product
|
'product' => $product,
|
||||||
|
'locations' => Location::with('nodes')->get(),
|
||||||
|
'nests' => Nest::with('eggs')->get(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,12 +138,20 @@ class ProductController extends Controller
|
||||||
"databases" => "required|numeric|max:1000000|min:0",
|
"databases" => "required|numeric|max:1000000|min:0",
|
||||||
"backups" => "required|numeric|max:1000000|min:0",
|
"backups" => "required|numeric|max:1000000|min:0",
|
||||||
"allocations" => "required|numeric|max:1000000|min:0",
|
"allocations" => "required|numeric|max:1000000|min:0",
|
||||||
|
"nodes.*" => "required|exists:nodes,id",
|
||||||
|
"eggs.*" => "required|exists:eggs,id",
|
||||||
"disabled" => "nullable",
|
"disabled" => "nullable",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$disabled = !is_null($request->input('disabled'));
|
$disabled = !is_null($request->input('disabled'));
|
||||||
$product->update(array_merge($request->all(), ['disabled' => $disabled]));
|
$product->update(array_merge($request->all(), ['disabled' => $disabled]));
|
||||||
|
|
||||||
|
#link nodes and eggs
|
||||||
|
$product->eggs()->detach();
|
||||||
|
$product->nodes()->detach();
|
||||||
|
$product->eggs()->attach($request->input('eggs'));
|
||||||
|
$product->nodes()->attach($request->input('nodes'));
|
||||||
|
|
||||||
return redirect()->route('admin.products.index')->with('success', 'product has been updated!');
|
return redirect()->route('admin.products.index')->with('success', 'product has been updated!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,6 +197,7 @@ class ProductController extends Controller
|
||||||
->addColumn('actions', function (Product $product) {
|
->addColumn('actions', function (Product $product) {
|
||||||
return '
|
return '
|
||||||
<a data-content="Show" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.products.show', $product->id) . '" class="btn btn-sm text-white btn-warning mr-1"><i class="fas fa-eye"></i></a>
|
<a data-content="Show" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.products.show', $product->id) . '" class="btn btn-sm text-white btn-warning mr-1"><i class="fas fa-eye"></i></a>
|
||||||
|
<a data-content="Clone" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.products.clone', $product->id) . '" class="btn btn-sm text-white btn-primary mr-1"><i class="fas fa-clone"></i></a>
|
||||||
<a data-content="Edit" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.products.edit', $product->id) . '" class="btn btn-sm btn-info mr-1"><i class="fas fa-pen"></i></a>
|
<a data-content="Edit" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.products.edit', $product->id) . '" class="btn btn-sm btn-info mr-1"><i class="fas fa-pen"></i></a>
|
||||||
|
|
||||||
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.products.destroy', $product->id) . '">
|
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.products.destroy', $product->id) . '">
|
||||||
|
@ -179,6 +211,12 @@ class ProductController extends Controller
|
||||||
->addColumn('servers', function (Product $product) {
|
->addColumn('servers', function (Product $product) {
|
||||||
return $product->servers()->count();
|
return $product->servers()->count();
|
||||||
})
|
})
|
||||||
|
->addColumn('nodes', function (Product $product) {
|
||||||
|
return $product->nodes()->count();
|
||||||
|
})
|
||||||
|
->addColumn('eggs', function (Product $product) {
|
||||||
|
return $product->eggs()->count();
|
||||||
|
})
|
||||||
->addColumn('disabled', function (Product $product) {
|
->addColumn('disabled', function (Product $product) {
|
||||||
$checked = $product->disabled == false ? "checked" : "";
|
$checked = $product->disabled == false ? "checked" : "";
|
||||||
return '
|
return '
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Egg;
|
||||||
|
use App\Models\Product;
|
||||||
use App\Models\UsefulLink;
|
use App\Models\UsefulLink;
|
||||||
use App\Models\Configuration;
|
use App\Models\Configuration;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
59
app/Http/Controllers/ProductController.php
Normal file
59
app/Http/Controllers/ProductController.php
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Egg;
|
||||||
|
use App\Models\Node;
|
||||||
|
use App\Models\Product;
|
||||||
|
use Illuminate\Contracts\Foundation\Application;
|
||||||
|
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
class ProductController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @description get product locations based on selected egg
|
||||||
|
* @param Request $request
|
||||||
|
* @param Egg $egg
|
||||||
|
* @return Collection|JsonResponse
|
||||||
|
*/
|
||||||
|
public function getNodesBasedOnEgg(Request $request, Egg $egg)
|
||||||
|
{
|
||||||
|
if (is_null($egg->id)) return response()->json('egg id is required', '400');
|
||||||
|
|
||||||
|
#get products that include this egg
|
||||||
|
$products = Product::query()->with('nodes')->whereHas('eggs', function (Builder $builder) use ($egg) {
|
||||||
|
$builder->where('id', '=', $egg->id);
|
||||||
|
})->get();
|
||||||
|
|
||||||
|
$nodes = collect();
|
||||||
|
|
||||||
|
#filter unique nodes
|
||||||
|
$products->each(function (Product $product) use ($nodes) {
|
||||||
|
$product->nodes->each(function (Node $node) use ($nodes) {
|
||||||
|
if (!$nodes->contains('id', $node->id) && !$node->disabled) {
|
||||||
|
$nodes->add($node);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return $nodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Node $node
|
||||||
|
* @return Collection|JsonResponse
|
||||||
|
*/
|
||||||
|
public function getProductsBasedOnNode(Node $node)
|
||||||
|
{
|
||||||
|
if (is_null($node->id)) return response()->json('node id is required', '400');
|
||||||
|
|
||||||
|
return Product::query()->whereHas('nodes', function (Builder $builder) use ($node) {
|
||||||
|
$builder->where('id' , '=' , $node->id);
|
||||||
|
})->get();
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,18 +5,17 @@ namespace App\Http\Controllers;
|
||||||
use App\Classes\Pterodactyl;
|
use App\Classes\Pterodactyl;
|
||||||
use App\Models\Configuration;
|
use App\Models\Configuration;
|
||||||
use App\Models\Egg;
|
use App\Models\Egg;
|
||||||
use App\Models\Location;
|
|
||||||
use App\Models\Nest;
|
use App\Models\Nest;
|
||||||
use App\Models\Node;
|
use App\Models\Node;
|
||||||
use App\Models\Product;
|
use App\Models\Product;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Notifications\ServerCreationError;
|
use App\Notifications\ServerCreationError;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Http\Client\Response;
|
use Illuminate\Http\Client\Response;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
use Illuminate\Support\Facades\Request as FacadesRequest;
|
use Illuminate\Support\Facades\Request as FacadesRequest;
|
||||||
|
|
||||||
class ServerController extends Controller
|
class ServerController extends Controller
|
||||||
|
@ -34,57 +33,25 @@ class ServerController extends Controller
|
||||||
{
|
{
|
||||||
if (!is_null($this->validateConfigurationRules())) return $this->validateConfigurationRules();
|
if (!is_null($this->validateConfigurationRules())) return $this->validateConfigurationRules();
|
||||||
|
|
||||||
|
$productCount = Product::query()->where('disabled', '=', false)->count();
|
||||||
|
|
||||||
|
$nodeCount = Node::query()->has('products')->count();
|
||||||
|
|
||||||
|
$eggs = Egg::query()->has('products')->get();
|
||||||
|
|
||||||
|
$nests = Nest::query()->whereHas('eggs', function (Builder $builder) {
|
||||||
|
$builder->has('products');
|
||||||
|
})->get();
|
||||||
|
|
||||||
return view('servers.create')->with([
|
return view('servers.create')->with([
|
||||||
'products' => Product::where('disabled', '=', false)->orderBy('price', 'asc')->get(),
|
'productCount' => $productCount,
|
||||||
'locations' => Location::whereHas('nodes', function ($query) {
|
'nodeCount' => $nodeCount,
|
||||||
$query->where('disabled', '=', false);
|
'nests' => $nests,
|
||||||
})->get(),
|
'eggs' => $eggs,
|
||||||
'nests' => Nest::where('disabled', '=', false)->get(),
|
'user' => Auth::user(),
|
||||||
'minimum_credits' => Configuration::getValueByKey('MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER', 50)
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Store a newly created resource in storage. */
|
|
||||||
public function store(Request $request)
|
|
||||||
{
|
|
||||||
if (!is_null($this->validateConfigurationRules())) return $this->validateConfigurationRules();
|
|
||||||
|
|
||||||
$request->validate([
|
|
||||||
"name" => "required|max:191",
|
|
||||||
"description" => "nullable|max:191",
|
|
||||||
"node_id" => "required|exists:nodes,id",
|
|
||||||
"egg_id" => "required|exists:eggs,id",
|
|
||||||
"product_id" => "required|exists:products,id"
|
|
||||||
]);
|
|
||||||
|
|
||||||
//get required resources
|
|
||||||
$egg = Egg::findOrFail($request->input('egg_id'));
|
|
||||||
$node = Node::findOrFail($request->input('node_id'));
|
|
||||||
$server = Auth::user()->servers()->create($request->all());
|
|
||||||
|
|
||||||
//get free allocation ID
|
|
||||||
$allocationId = Pterodactyl::getFreeAllocationId($node);
|
|
||||||
if (!$allocationId) return $this->noAllocationsError($server);
|
|
||||||
|
|
||||||
//create server on pterodactyl
|
|
||||||
$response = Pterodactyl::createServer($server, $egg, $allocationId);
|
|
||||||
if ($response->failed()) return $this->serverCreationFailed($response, $server);
|
|
||||||
|
|
||||||
//update server with pterodactyl_id
|
|
||||||
$server->update([
|
|
||||||
'pterodactyl_id' => $response->json()['attributes']['id'],
|
|
||||||
'identifier' => $response->json()['attributes']['identifier']
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (Configuration::getValueByKey('SERVER_CREATE_CHARGE_FIRST_HOUR', 'true') == 'true') {
|
|
||||||
if (Auth::user()->credits >= $server->product->getHourlyPrice()) {
|
|
||||||
Auth::user()->decrement('credits', $server->product->getHourlyPrice());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return redirect()->route('servers.index')->with('success', 'server created');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return null|RedirectResponse
|
* @return null|RedirectResponse
|
||||||
*/
|
*/
|
||||||
|
@ -96,8 +63,8 @@ class ServerController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
// minimum credits
|
// minimum credits
|
||||||
if (FacadesRequest::has("product_id")) {
|
if (FacadesRequest::has("product")) {
|
||||||
$product = Product::findOrFail(FacadesRequest::input("product_id"));
|
$product = Product::findOrFail(FacadesRequest::input("product"));
|
||||||
if (
|
if (
|
||||||
Auth::user()->credits <
|
Auth::user()->credits <
|
||||||
($product->minimum_credits == -1
|
($product->minimum_credits == -1
|
||||||
|
@ -121,17 +88,54 @@ class ServerController extends Controller
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Remove the specified resource from storage. */
|
/** Store a newly created resource in storage. */
|
||||||
public function destroy(Server $server)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
try {
|
/** @var Node $node */
|
||||||
$server->delete();
|
/** @var Egg $egg */
|
||||||
return redirect()->route('servers.index')->with('success', 'server removed');
|
/** @var Product $product */
|
||||||
} catch (Exception $e) {
|
|
||||||
return redirect()->route('servers.index')->with('error', 'An exception has occurred while trying to remove a resource "' . $e->getMessage() . '"');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!is_null($this->validateConfigurationRules())) return $this->validateConfigurationRules();
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
"name" => "required|max:191",
|
||||||
|
"node" => "required|exists:nodes,id",
|
||||||
|
"egg" => "required|exists:eggs,id",
|
||||||
|
"product" => "required|exists:products,id"
|
||||||
|
]);
|
||||||
|
|
||||||
|
//get required resources
|
||||||
|
$product = Product::query()->findOrFail($request->input('product'));
|
||||||
|
$egg = $product->eggs()->findOrFail($request->input('egg'));
|
||||||
|
$node = $product->nodes()->findOrFail($request->input('node'));
|
||||||
|
|
||||||
|
$server = $request->user()->servers()->create([
|
||||||
|
'name' => $request->input('name'),
|
||||||
|
'product_id' => $request->input('product'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
//get free allocation ID
|
||||||
|
$allocationId = Pterodactyl::getFreeAllocationId($node);
|
||||||
|
if (!$allocationId) return $this->noAllocationsError($server);
|
||||||
|
|
||||||
|
//create server on pterodactyl
|
||||||
|
$response = Pterodactyl::createServer($server, $egg, $allocationId);
|
||||||
|
if ($response->failed()) return $this->serverCreationFailed($response, $server);
|
||||||
|
|
||||||
|
//update server with pterodactyl_id
|
||||||
|
$server->update([
|
||||||
|
'pterodactyl_id' => $response->json()['attributes']['id'],
|
||||||
|
'identifier' => $response->json()['attributes']['identifier']
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (Configuration::getValueByKey('SERVER_CREATE_CHARGE_FIRST_HOUR', 'true') == 'true') {
|
||||||
|
if ($request->user()->credits >= $server->product->getHourlyPrice()) {
|
||||||
|
$request->user()->decrement('credits', $server->product->getHourlyPrice());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('servers.index')->with('success', 'server created');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return redirect with error
|
* return redirect with error
|
||||||
|
@ -158,4 +162,15 @@ class ServerController extends Controller
|
||||||
|
|
||||||
return redirect()->route('servers.index')->with('error', json_encode($response->json()));
|
return redirect()->route('servers.index')->with('error', json_encode($response->json()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Remove the specified resource from storage. */
|
||||||
|
public function destroy(Server $server)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$server->delete();
|
||||||
|
return redirect()->route('servers.index')->with('success', 'server removed');
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return redirect()->route('servers.index')->with('error', 'An exception has occurred while trying to remove a resource "' . $e->getMessage() . '"');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ use App\Classes\Pterodactyl;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
|
||||||
class Egg extends Model
|
class Egg extends Model
|
||||||
{
|
{
|
||||||
|
@ -21,14 +22,68 @@ class Egg extends Model
|
||||||
'docker_image',
|
'docker_image',
|
||||||
'startup',
|
'startup',
|
||||||
'environment',
|
'environment',
|
||||||
|
'updated_at',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
public static function boot()
|
||||||
* @return BelongsTo
|
|
||||||
*/
|
|
||||||
public function nest()
|
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Nest::class, 'id', 'nest_id');
|
parent::boot(); // TODO: Change the autogenerated stub
|
||||||
|
|
||||||
|
static::deleting(function (Egg $egg) {
|
||||||
|
$egg->products()->detach();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function syncEggs()
|
||||||
|
{
|
||||||
|
Nest::syncNests();
|
||||||
|
|
||||||
|
Nest::all()->each(function (Nest $nest) {
|
||||||
|
$eggs = Pterodactyl::getEggs($nest);
|
||||||
|
|
||||||
|
foreach ($eggs as $egg) {
|
||||||
|
$array = [];
|
||||||
|
$environment = [];
|
||||||
|
|
||||||
|
$array['id'] = $egg['attributes']['id'];
|
||||||
|
$array['nest_id'] = $egg['attributes']['nest'];
|
||||||
|
$array['name'] = $egg['attributes']['name'];
|
||||||
|
$array['description'] = $egg['attributes']['description'];
|
||||||
|
$array['docker_image'] = $egg['attributes']['docker_image'];
|
||||||
|
$array['startup'] = $egg['attributes']['startup'];
|
||||||
|
$array['updated_at'] = now();
|
||||||
|
|
||||||
|
//get environment variables
|
||||||
|
foreach ($egg['attributes']['relationships']['variables']['data'] as $variable) {
|
||||||
|
$environment[$variable['attributes']['env_variable']] = $variable['attributes']['default_value'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$array['environment'] = json_encode([$environment]);
|
||||||
|
|
||||||
|
self::query()->updateOrCreate([
|
||||||
|
'id' => $array['id']
|
||||||
|
], array_diff_key($array, array_flip(["id"]))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
self::removeDeletedEggs($nest, $eggs);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description remove eggs that have been deleted on pterodactyl
|
||||||
|
* @param Nest $nest
|
||||||
|
* @param array $eggs
|
||||||
|
*/
|
||||||
|
private static function removeDeletedEggs(Nest $nest, array $eggs): void
|
||||||
|
{
|
||||||
|
$ids = array_map(function ($data) {
|
||||||
|
return $data['attributes']['id'];
|
||||||
|
}, $eggs);
|
||||||
|
|
||||||
|
$nest->eggs()->each(function (Egg $egg) use ($ids) {
|
||||||
|
if (!in_array($egg->id, $ids)) $egg->delete();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,7 +94,7 @@ class Egg extends Model
|
||||||
$array = [];
|
$array = [];
|
||||||
|
|
||||||
foreach (json_decode($this->environment) as $variable) {
|
foreach (json_decode($this->environment) as $variable) {
|
||||||
foreach ($variable as $key => $value){
|
foreach ($variable as $key => $value) {
|
||||||
$array[$key] = $value;
|
$array[$key] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,34 +102,19 @@ class Egg extends Model
|
||||||
return $array;
|
return $array;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function syncEggs(){
|
/**
|
||||||
|
* @return BelongsTo
|
||||||
Nest::all()->each(function (Nest $nest) {
|
*/
|
||||||
$eggs = Pterodactyl::getEggs($nest);
|
public function nest()
|
||||||
|
{
|
||||||
foreach ($eggs as $egg){
|
return $this->belongsTo(Nest::class);
|
||||||
$array = [];
|
}
|
||||||
$environment = [];
|
|
||||||
|
|
||||||
$array['id'] = $egg['attributes']['id'];
|
|
||||||
$array['nest_id'] = $egg['attributes']['nest'];
|
|
||||||
$array['name'] = $egg['attributes']['name'];
|
|
||||||
$array['description'] = $egg['attributes']['description'];
|
|
||||||
$array['docker_image'] = $egg['attributes']['docker_image'];
|
|
||||||
$array['startup'] = $egg['attributes']['startup'];
|
|
||||||
|
|
||||||
//get environment variables
|
|
||||||
foreach ($egg['attributes']['relationships']['variables']['data'] as $variable){
|
|
||||||
$environment[$variable['attributes']['env_variable']] = $variable['attributes']['default_value'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$array['environment'] = json_encode([$environment]);
|
|
||||||
|
|
||||||
self::firstOrCreate(['id' => $array['id']] , $array);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return BelongsToMany
|
||||||
|
*/
|
||||||
|
public function products()
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(Product::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,28 +15,68 @@ class Location extends Model
|
||||||
|
|
||||||
public $guarded = [];
|
public $guarded = [];
|
||||||
|
|
||||||
|
public static function boot()
|
||||||
|
{
|
||||||
|
parent::boot(); // TODO: Change the autogenerated stub
|
||||||
|
|
||||||
public function nodes(){
|
static::deleting(function (Location $location) {
|
||||||
return $this->hasMany(Node::class , 'location_id' , 'id');
|
$location->nodes()->each(function (Node $node) {
|
||||||
|
$node->delete();
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sync locations with pterodactyl panel
|
* Sync locations with pterodactyl panel
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function syncLocations(){
|
public static function syncLocations()
|
||||||
|
{
|
||||||
$locations = Pterodactyl::getLocations();
|
$locations = Pterodactyl::getLocations();
|
||||||
|
|
||||||
$locations = array_map(function($val) {
|
//map response
|
||||||
|
$locations = array_map(function ($val) {
|
||||||
return array(
|
return array(
|
||||||
'id' => $val['attributes']['id'],
|
'id' => $val['attributes']['id'],
|
||||||
'name' => $val['attributes']['short'],
|
'name' => $val['attributes']['short'],
|
||||||
'description' => $val['attributes']['long']
|
'description' => $val['attributes']['long']
|
||||||
);
|
);
|
||||||
}, $locations);
|
}, $locations);
|
||||||
|
|
||||||
|
//update or create
|
||||||
foreach ($locations as $location) {
|
foreach ($locations as $location) {
|
||||||
self::firstOrCreate(['id' => $location['id']] , $location);
|
self::query()->updateOrCreate(
|
||||||
|
[
|
||||||
|
'id' => $location['id']
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => $location['name'],
|
||||||
|
'description' => $location['name'],
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self::removeDeletedLocation($locations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description remove locations that have been deleted on pterodactyl
|
||||||
|
* @param array $locations
|
||||||
|
*/
|
||||||
|
private static function removeDeletedLocation(array $locations): void
|
||||||
|
{
|
||||||
|
$ids = array_map(function ($data) {
|
||||||
|
return $data['id'];
|
||||||
|
}, $locations);
|
||||||
|
|
||||||
|
self::all()->each(function (Location $location) use ($ids) {
|
||||||
|
if (!in_array($location->id, $ids)) $location->delete();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function nodes()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Node::class, 'location_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,17 +19,60 @@ class Nest extends Model
|
||||||
'disabled',
|
'disabled',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public static function boot()
|
||||||
|
{
|
||||||
|
parent::boot(); // TODO: Change the autogenerated stub
|
||||||
|
|
||||||
public function eggs(){
|
static::deleting(function (Nest $nest) {
|
||||||
return $this->hasMany(Egg::class);
|
$nest->eggs()->each(function (Egg $egg) {
|
||||||
|
$egg->delete();
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function syncNests(){
|
public static function syncNests()
|
||||||
self::query()->delete();
|
{
|
||||||
$nests = Pterodactyl::getNests();
|
$nests = Pterodactyl::getNests();
|
||||||
|
|
||||||
|
//map response
|
||||||
|
$nests = array_map(function ($nest) {
|
||||||
|
return array(
|
||||||
|
'id' => $nest['attributes']['id'],
|
||||||
|
'name' => $nest['attributes']['name'],
|
||||||
|
'description' => $nest['attributes']['description'],
|
||||||
|
);
|
||||||
|
}, $nests);
|
||||||
|
|
||||||
foreach ($nests as $nest) {
|
foreach ($nests as $nest) {
|
||||||
self::firstOrCreate(['id' => $nest['attributes']['id']] , array_merge($nest['attributes'] , ['disabled' => '1']));
|
self::query()->updateOrCreate([
|
||||||
|
'id' => $nest['id']
|
||||||
|
], [
|
||||||
|
'name' => $nest['name'],
|
||||||
|
'description' => $nest['description'],
|
||||||
|
'disabled' => false
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self::removeDeletedNests($nests);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description remove nests that have been deleted on pterodactyl
|
||||||
|
* @param array $nests
|
||||||
|
*/
|
||||||
|
private static function removeDeletedNests(array $nests): void
|
||||||
|
{
|
||||||
|
$ids = array_map(function ($data) {
|
||||||
|
return $data['id'];
|
||||||
|
}, $nests);
|
||||||
|
|
||||||
|
self::all()->each(function (Nest $nest) use ($ids) {
|
||||||
|
if (!in_array($nest->id, $ids)) $nest->delete();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function eggs()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Egg::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ use Exception;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
|
||||||
class Node extends Model
|
class Node extends Model
|
||||||
{
|
{
|
||||||
|
@ -16,6 +17,65 @@ class Node extends Model
|
||||||
|
|
||||||
public $guarded = [];
|
public $guarded = [];
|
||||||
|
|
||||||
|
public static function boot()
|
||||||
|
{
|
||||||
|
parent::boot(); // TODO: Change the autogenerated stub
|
||||||
|
|
||||||
|
static::deleting(function (Node $node) {
|
||||||
|
$node->products()->detach();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static function syncNodes()
|
||||||
|
{
|
||||||
|
Location::syncLocations();
|
||||||
|
$nodes = Pterodactyl::getNodes();
|
||||||
|
|
||||||
|
//map response
|
||||||
|
$nodes = array_map(function ($node) {
|
||||||
|
return array(
|
||||||
|
'id' => $node['attributes']['id'],
|
||||||
|
'location_id' => $node['attributes']['location_id'],
|
||||||
|
'name' => $node['attributes']['name'],
|
||||||
|
'description' => $node['attributes']['description'],
|
||||||
|
);
|
||||||
|
}, $nodes);
|
||||||
|
|
||||||
|
//update or create
|
||||||
|
foreach ($nodes as $node) {
|
||||||
|
self::query()->updateOrCreate(
|
||||||
|
[
|
||||||
|
'id' => $node['id']
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => $node['name'],
|
||||||
|
'description' => $node['description'],
|
||||||
|
'location_id' => $node['location_id'],
|
||||||
|
'disabled' => false
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
self::removeDeletedNodes($nodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description remove nodes that have been deleted on pterodactyl
|
||||||
|
* @param array $nodes
|
||||||
|
*/
|
||||||
|
private static function removeDeletedNodes(array $nodes): void
|
||||||
|
{
|
||||||
|
$ids = array_map(function ($data) {
|
||||||
|
return $data['id'];
|
||||||
|
}, $nodes);
|
||||||
|
|
||||||
|
self::all()->each(function (Node $node) use ($ids) {
|
||||||
|
if (!in_array($node->id, $ids)) $node->delete();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return BelongsTo
|
* @return BelongsTo
|
||||||
|
@ -26,26 +86,10 @@ class Node extends Model
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @return BelongsToMany
|
||||||
*/
|
*/
|
||||||
public static function syncNodes(){
|
public function products()
|
||||||
Location::syncLocations();
|
{
|
||||||
$nodes = Pterodactyl::getNodes();
|
return $this->belongsToMany(Product::class);
|
||||||
|
|
||||||
|
|
||||||
$nodes = array_map(function($node) {
|
|
||||||
return array(
|
|
||||||
'id' => $node['attributes']['id'],
|
|
||||||
'location_id' => $node['attributes']['location_id'],
|
|
||||||
'name' => $node['attributes']['name'],
|
|
||||||
'description' => $node['attributes']['description'],
|
|
||||||
'disabled' => '1'
|
|
||||||
);
|
|
||||||
}, $nodes);
|
|
||||||
|
|
||||||
foreach ($nodes as $node) {
|
|
||||||
self::firstOrCreate(['id' => $node['id']] , $node);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,14 @@ use Hidehalo\Nanoid\Client;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class Product extends Model
|
class Product extends Model
|
||||||
{
|
{
|
||||||
use HasFactory, LogsActivity;
|
use HasFactory;
|
||||||
|
use LogsActivity;
|
||||||
|
|
||||||
public $incrementing = false;
|
public $incrementing = false;
|
||||||
|
|
||||||
|
@ -25,6 +28,11 @@ class Product extends Model
|
||||||
|
|
||||||
$product->{$product->getKeyName()} = $client->generateId($size = 21);
|
$product->{$product->getKeyName()} = $client->generateId($size = 21);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
static::deleting(function(Product $product) {
|
||||||
|
$product->nodes()->detach();
|
||||||
|
$product->eggs()->detach();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHourlyPrice()
|
public function getHourlyPrice()
|
||||||
|
@ -45,8 +53,22 @@ class Product extends Model
|
||||||
/**
|
/**
|
||||||
* @return BelongsTo
|
* @return BelongsTo
|
||||||
*/
|
*/
|
||||||
public function servers(): BelongsTo
|
public function servers()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Server::class, 'id', 'product_id');
|
return $this->belongsTo(Server::class, 'id', 'product_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return BelongsToMany
|
||||||
|
*/
|
||||||
|
public function eggs() {
|
||||||
|
return $this->belongsToMany(Egg::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return BelongsToMany
|
||||||
|
*/
|
||||||
|
public function nodes() {
|
||||||
|
return $this->belongsToMany(Node::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
"yajra/laravel-datatables-oracle": "~9.0"
|
"yajra/laravel-datatables-oracle": "~9.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"barryvdh/laravel-debugbar": "^3.6",
|
||||||
"facade/ignition": "^2.5",
|
"facade/ignition": "^2.5",
|
||||||
"fakerphp/faker": "^1.9.1",
|
"fakerphp/faker": "^1.9.1",
|
||||||
"laravel/sail": "^1.0.1",
|
"laravel/sail": "^1.0.1",
|
||||||
|
|
222
composer.lock
generated
222
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "f7ba581ff6641d3ab79d558070e99f3c",
|
"content-hash": "500346cc4a4a83b162e07bb0071d1602",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "asm89/stack-cors",
|
"name": "asm89/stack-cors",
|
||||||
|
@ -6202,6 +6202,91 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [
|
"packages-dev": [
|
||||||
|
{
|
||||||
|
"name": "barryvdh/laravel-debugbar",
|
||||||
|
"version": "v3.6.4",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/barryvdh/laravel-debugbar.git",
|
||||||
|
"reference": "3c2d678269ba60e178bcd93e36f6a91c36b727f1"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/3c2d678269ba60e178bcd93e36f6a91c36b727f1",
|
||||||
|
"reference": "3c2d678269ba60e178bcd93e36f6a91c36b727f1",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"illuminate/routing": "^6|^7|^8",
|
||||||
|
"illuminate/session": "^6|^7|^8",
|
||||||
|
"illuminate/support": "^6|^7|^8",
|
||||||
|
"maximebf/debugbar": "^1.17.2",
|
||||||
|
"php": ">=7.2",
|
||||||
|
"symfony/debug": "^4.3|^5",
|
||||||
|
"symfony/finder": "^4.3|^5"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"mockery/mockery": "^1.3.3",
|
||||||
|
"orchestra/testbench-dusk": "^4|^5|^6",
|
||||||
|
"phpunit/phpunit": "^8.5|^9.0",
|
||||||
|
"squizlabs/php_codesniffer": "^3.5"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.6-dev"
|
||||||
|
},
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"Barryvdh\\Debugbar\\ServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {
|
||||||
|
"Debugbar": "Barryvdh\\Debugbar\\Facade"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Barryvdh\\Debugbar\\": "src/"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"src/helpers.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Barry vd. Heuvel",
|
||||||
|
"email": "barryvdh@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP Debugbar integration for Laravel",
|
||||||
|
"keywords": [
|
||||||
|
"debug",
|
||||||
|
"debugbar",
|
||||||
|
"laravel",
|
||||||
|
"profiler",
|
||||||
|
"webprofiler"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/barryvdh/laravel-debugbar/issues",
|
||||||
|
"source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.6.4"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://fruitcake.nl",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/barryvdh",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2021-10-21T10:57:31+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/instantiator",
|
"name": "doctrine/instantiator",
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
|
@ -6713,6 +6798,71 @@
|
||||||
},
|
},
|
||||||
"time": "2021-05-25T16:41:13+00:00"
|
"time": "2021-05-25T16:41:13+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "maximebf/debugbar",
|
||||||
|
"version": "v1.17.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/maximebf/php-debugbar.git",
|
||||||
|
"reference": "e8ac3499af0ea5b440908e06cc0abe5898008b3c"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/e8ac3499af0ea5b440908e06cc0abe5898008b3c",
|
||||||
|
"reference": "e8ac3499af0ea5b440908e06cc0abe5898008b3c",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.1|^8",
|
||||||
|
"psr/log": "^1|^2|^3",
|
||||||
|
"symfony/var-dumper": "^2.6|^3|^4|^5"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^7.5.20 || ^9.4.2"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"kriswallsmith/assetic": "The best way to manage assets",
|
||||||
|
"monolog/monolog": "Log using Monolog",
|
||||||
|
"predis/predis": "Redis storage"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.17-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"DebugBar\\": "src/DebugBar/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Maxime Bouroumeau-Fuseau",
|
||||||
|
"email": "maxime.bouroumeau@gmail.com",
|
||||||
|
"homepage": "http://maximebf.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Barry vd. Heuvel",
|
||||||
|
"email": "barryvdh@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Debug bar in the browser for php application",
|
||||||
|
"homepage": "https://github.com/maximebf/php-debugbar",
|
||||||
|
"keywords": [
|
||||||
|
"debug",
|
||||||
|
"debugbar"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/maximebf/php-debugbar/issues",
|
||||||
|
"source": "https://github.com/maximebf/php-debugbar/tree/v1.17.3"
|
||||||
|
},
|
||||||
|
"time": "2021-10-19T12:33:27+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "mockery/mockery",
|
"name": "mockery/mockery",
|
||||||
"version": "1.4.3",
|
"version": "1.4.3",
|
||||||
|
@ -8652,6 +8802,74 @@
|
||||||
],
|
],
|
||||||
"time": "2020-09-28T06:39:44+00:00"
|
"time": "2020-09-28T06:39:44+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/debug",
|
||||||
|
"version": "v4.4.31",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/debug.git",
|
||||||
|
"reference": "43ede438d4cb52cd589ae5dc070e9323866ba8e0"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/debug/zipball/43ede438d4cb52cd589ae5dc070e9323866ba8e0",
|
||||||
|
"reference": "43ede438d4cb52cd589ae5dc070e9323866ba8e0",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.1.3",
|
||||||
|
"psr/log": "^1|^2|^3"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"symfony/http-kernel": "<3.4"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"symfony/http-kernel": "^3.4|^4.0|^5.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\Debug\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Provides tools to ease debugging PHP code",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/debug/tree/v4.4.31"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2021-09-24T13:30:14+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "theseer/tokenizer",
|
"name": "theseer/tokenizer",
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
|
@ -8713,5 +8931,5 @@
|
||||||
"ext-intl": "*"
|
"ext-intl": "*"
|
||||||
},
|
},
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
"plugin-api-version": "2.1.0"
|
"plugin-api-version": "2.0.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateEggProductTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('egg_product', function (Blueprint $table) {
|
||||||
|
$table->foreignId('egg_id')->constrained();
|
||||||
|
$table->foreignUuid('product_id')->constrained();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('egg_product');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateNodeProductTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('node_product', function (Blueprint $table) {
|
||||||
|
$table->foreignId('node_id')->constrained();
|
||||||
|
$table->foreignUuid('product_id')->constrained();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('node_product');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddDisabledToEggsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('eggs', function (Blueprint $table) {
|
||||||
|
$table->boolean('disabled')->default(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('eggs', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('disabled');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
13843
package-lock.json
generated
13843
package-lock.json
generated
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
2
public/js/app.js
vendored
2
public/js/app.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
5
resources/js/alpine.js
vendored
Normal file
5
resources/js/alpine.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
resources/js/app.js
vendored
1
resources/js/app.js
vendored
|
@ -3,3 +3,4 @@ require('./slim.kickstart.min')
|
||||||
require('./bootstrap');
|
require('./bootstrap');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
8
resources/js/bootstrap.js
vendored
8
resources/js/bootstrap.js
vendored
|
@ -18,10 +18,10 @@ try {
|
||||||
* to our Laravel back-end. This library automatically handles sending the
|
* to our Laravel back-end. This library automatically handles sending the
|
||||||
* CSRF token as a header based on the value of the "XSRF" token cookie.
|
* CSRF token as a header based on the value of the "XSRF" token cookie.
|
||||||
*/
|
*/
|
||||||
//
|
|
||||||
// window.axios = require('axios');
|
window.axios = require('axios');
|
||||||
//
|
|
||||||
// window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Echo exposes an expressive API for subscribing to channels and listening
|
* Echo exposes an expressive API for subscribing to channels and listening
|
||||||
|
|
153
resources/views/admin/overview/index.blade.php
Normal file
153
resources/views/admin/overview/index.blade.php
Normal file
|
@ -0,0 +1,153 @@
|
||||||
|
@extends('layouts.main')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<!-- CONTENT HEADER -->
|
||||||
|
<section class="content-header">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row mb-2">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<h1>Admin Overview</h1>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<ol class="breadcrumb float-sm-right">
|
||||||
|
<li class="breadcrumb-item"><a href="{{route('home')}}">Dashboard</a></li>
|
||||||
|
<li class="breadcrumb-item"><a class="text-muted"
|
||||||
|
href="{{route('admin.overview.index')}}">Admin Overview</a></li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<!-- END CONTENT HEADER -->
|
||||||
|
|
||||||
|
<!-- MAIN CONTENT -->
|
||||||
|
<section class="content">
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<a href="https://discord.gg/4Y6HjD2uyU" class="btn btn-dark btn-block px-3"><i
|
||||||
|
class="fab fa-discord mr-2"></i> {{__('Support server')}}</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<a href="https://controlpanel.gg/docs/intro" class="btn btn-dark btn-block px-3"><i
|
||||||
|
class="fas fa-link mr-2"></i> {{__('Documentation')}}</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<a href="https://github.com/ControlPanel-gg/dashboard" class="btn btn-dark btn-block px-3"><i
|
||||||
|
class="fab fa-github mr-2"></i> {{__('Github')}}</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<a href="https://controlpanel.gg/docs/Contributing/donating" class="btn btn-dark btn-block px-3"><i
|
||||||
|
class="fas fa-money-bill mr-2"></i> {{__('Support ControlPanel')}}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-sm-6 col-md-3">
|
||||||
|
<div class="info-box">
|
||||||
|
<span class="info-box-icon bg-info elevation-1"><i class="fas fa-server"></i></span>
|
||||||
|
|
||||||
|
<div class="info-box-content">
|
||||||
|
<span class="info-box-text">{{__('Servers')}}</span>
|
||||||
|
<span class="info-box-number">{{$serverCount}}</span>
|
||||||
|
</div>
|
||||||
|
<!-- /.info-box-content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.info-box -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12 col-sm-6 col-md-3">
|
||||||
|
<div class="info-box">
|
||||||
|
<span class="info-box-icon bg-primary elevation-1"><i class="fas fa-users"></i></span>
|
||||||
|
|
||||||
|
<div class="info-box-content">
|
||||||
|
<span class="info-box-text">{{__('Users')}}</span>
|
||||||
|
<span class="info-box-number">{{$userCount}}</span>
|
||||||
|
</div>
|
||||||
|
<!-- /.info-box-content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.info-box -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12 col-sm-6 col-md-3">
|
||||||
|
<div class="info-box">
|
||||||
|
<span class="info-box-icon bg-warning elevation-1"><i
|
||||||
|
class="fas fa-coins text-white"></i></span>
|
||||||
|
|
||||||
|
<div class="info-box-content">
|
||||||
|
<span class="info-box-text">{{__('Total')}} {{CREDITS_DISPLAY_NAME}}</span>
|
||||||
|
<span class="info-box-number">{{$creditCount}}</span>
|
||||||
|
</div>
|
||||||
|
<!-- /.info-box-content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.info-box -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12 col-sm-6 col-md-3">
|
||||||
|
<div class="info-box">
|
||||||
|
<span class="info-box-icon bg-success elevation-1"><i class="fas fa-money-bill"></i></span>
|
||||||
|
|
||||||
|
<div class="info-box-content">
|
||||||
|
<span class="info-box-text">{{__('Payments')}}</span>
|
||||||
|
<span class="info-box-number">{{$paymentCount}}</span>
|
||||||
|
</div>
|
||||||
|
<!-- /.info-box-content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.info-box -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<div class="card-title ">
|
||||||
|
<span><i class="fas fa-kiwi-bird mr-2"></i>{{__('Pterodactyl')}}</span>
|
||||||
|
</div>
|
||||||
|
<a href="{{route('admin.overview.sync')}}" class="btn btn-primary btn-sm"><i
|
||||||
|
class="fas fa-sync mr-2"></i>{{__('Sync')}}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body py-1">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{__('Resources')}}</th>
|
||||||
|
<th>{{__('Count')}}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>{{__('Locations')}}</td>
|
||||||
|
<td>{{$locationCount}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{__('Nodes')}}</td>
|
||||||
|
<td>{{$nodeCount}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{__('Nests')}}</td>
|
||||||
|
<td>{{$nestCount}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{__('Eggs')}}</td>
|
||||||
|
<td>{{$eggCount}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<span><i class="fas fa-sync mr-2"></i>{{__('Last updated :date', ['date' => $syncLastUpdate])}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- END CUSTOM CONTENT -->
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<!-- END CONTENT -->
|
||||||
|
@endsection
|
|
@ -13,7 +13,7 @@
|
||||||
<li class="breadcrumb-item"><a href="{{ route('home') }}">Dashboard</a></li>
|
<li class="breadcrumb-item"><a href="{{ route('home') }}">Dashboard</a></li>
|
||||||
<li class="breadcrumb-item"><a href="{{ route('admin.products.index') }}">Products</a></li>
|
<li class="breadcrumb-item"><a href="{{ route('admin.products.index') }}">Products</a></li>
|
||||||
<li class="breadcrumb-item"><a class="text-muted"
|
<li class="breadcrumb-item"><a class="text-muted"
|
||||||
href="{{ route('admin.products.create') }}">Create</a>
|
href="{{ route('admin.products.create') }}">Create</a>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
@ -25,19 +25,22 @@
|
||||||
<!-- MAIN CONTENT -->
|
<!-- MAIN CONTENT -->
|
||||||
<section class="content">
|
<section class="content">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
<form action="{{route('admin.products.store')}}" method="POST">
|
||||||
|
@csrf
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="card-title">Product Details</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-6">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
<form action="{{ route('admin.products.store') }}" method="POST">
|
|
||||||
@csrf
|
|
||||||
<div class="d-flex flex-row-reverse">
|
<div class="d-flex flex-row-reverse">
|
||||||
<div class="custom-control custom-switch">
|
<div class="custom-control custom-switch">
|
||||||
<input type="checkbox" name="disabled"
|
<input type="checkbox" name="disabled"
|
||||||
class="custom-control-input custom-control-input-danger" id="switch1">
|
class="custom-control-input custom-control-input-danger" id="switch1">
|
||||||
<label class="custom-control-label" for="switch1">Disabled <i data-toggle="popover"
|
<label class="custom-control-label" for="switch1">Disabled <i
|
||||||
data-trigger="hover"
|
data-toggle="popover" data-trigger="hover"
|
||||||
data-content="Will hide this option from being selected"
|
data-content="Will hide this option from being selected"
|
||||||
class="fas fa-info-circle"></i></label>
|
class="fas fa-info-circle"></i></label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -47,75 +50,84 @@
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="name">Name</label>
|
<label for="name">Name</label>
|
||||||
<input value="{{ old('name') }}" id="name" name="name" type="text"
|
<input value="{{$product->name ?? old('name')}}" id="name" name="name"
|
||||||
class="form-control @error('name') is-invalid @enderror"
|
type="text"
|
||||||
required="required">
|
class="form-control @error('name') is-invalid @enderror"
|
||||||
|
required="required">
|
||||||
@error('name')
|
@error('name')
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{{ $message }}
|
{{ $message }}
|
||||||
</div>
|
</div>
|
||||||
@enderror
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="price">Price in {{ CREDITS_DISPLAY_NAME }}</label>
|
<label for="price">Price in credits</label>
|
||||||
<input value="{{ old('price') }}" id="price" name="price" type="number"
|
<input value="{{$product->price ?? old('price')}}" id="price" name="price"
|
||||||
class="form-control @error('price') is-invalid @enderror"
|
type="number"
|
||||||
required="required">
|
class="form-control @error('price') is-invalid @enderror"
|
||||||
|
required="required">
|
||||||
@error('price')
|
@error('price')
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{{ $message }}
|
{{ $message }}
|
||||||
</div>
|
</div>
|
||||||
@enderror
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="memory">Memory</label>
|
<label for="memory">Memory</label>
|
||||||
<input value="{{ old('memory') }}" id="memory" name="memory" type="number"
|
<input value="{{$product->memory ?? old('memory')}}" id="memory"
|
||||||
class="form-control @error('memory') is-invalid @enderror"
|
name="memory"
|
||||||
required="required">
|
type="number"
|
||||||
|
class="form-control @error('memory') is-invalid @enderror"
|
||||||
|
required="required">
|
||||||
@error('memory')
|
@error('memory')
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{{ $message }}
|
{{ $message }}
|
||||||
</div>
|
</div>
|
||||||
@enderror
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="cpu">Cpu</label>
|
<label for="cpu">Cpu</label>
|
||||||
<input value="{{ old('cpu') }}" id="cpu" name="cpu" type="number"
|
<input value="{{$product->cpu ?? old('cpu')}}" id="cpu" name="cpu"
|
||||||
class="form-control @error('cpu') is-invalid @enderror" required="required">
|
type="number"
|
||||||
|
class="form-control @error('cpu') is-invalid @enderror"
|
||||||
|
required="required">
|
||||||
@error('cpu')
|
@error('cpu')
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{{ $message }}
|
{{ $message }}
|
||||||
</div>
|
</div>
|
||||||
@enderror
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="swap">Swap</label>
|
<label for="swap">Swap</label>
|
||||||
<input value="{{ old('swap') }}" id="swap" name="swap" type="number"
|
<input value="{{$product->swap ?? old('swap')}}" id="swap" name="swap"
|
||||||
class="form-control @error('swap') is-invalid @enderror"
|
type="number"
|
||||||
required="required">
|
class="form-control @error('swap') is-invalid @enderror"
|
||||||
|
required="required">
|
||||||
@error('swap')
|
@error('swap')
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{{ $message }}
|
{{ $message }}
|
||||||
</div>
|
</div>
|
||||||
@enderror
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="description">Description <i data-toggle="popover"
|
<label for="description">Description <i data-toggle="popover"
|
||||||
data-trigger="hover" data-content="This is what the users sees"
|
data-trigger="hover"
|
||||||
class="fas fa-info-circle"></i></label>
|
data-content="This is what the users sees"
|
||||||
<textarea id="description" name="description" type="text"
|
class="fas fa-info-circle"></i></label>
|
||||||
class="form-control @error('description') is-invalid @enderror"
|
<textarea id="description" name="description"
|
||||||
required="required">{{ old('description') }}</textarea>
|
type="text"
|
||||||
|
class="form-control @error('description') is-invalid @enderror"
|
||||||
|
required="required">{{$product->description ?? old('description')}}</textarea>
|
||||||
@error('description')
|
@error('description')
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{{ $message }}
|
{{ $message }}
|
||||||
</div>
|
</div>
|
||||||
@enderror
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -123,13 +135,15 @@
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="disk">Disk</label>
|
<label for="disk">Disk</label>
|
||||||
<input value="{{ old('disk') ?? 1000 }}" id="disk" name="disk" type="number"
|
<input value="{{$product->disk ?? old('disk') ?? 1000}}" id="disk"
|
||||||
class="form-control @error('disk') is-invalid @enderror"
|
name="disk"
|
||||||
required="required">
|
type="number"
|
||||||
|
class="form-control @error('disk') is-invalid @enderror"
|
||||||
|
required="required">
|
||||||
@error('disk')
|
@error('disk')
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{{ $message }}
|
{{ $message }}
|
||||||
</div>
|
</div>
|
||||||
@enderror
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -139,58 +153,66 @@
|
||||||
data-content="Setting to -1 will use the value from configuration."
|
data-content="Setting to -1 will use the value from configuration."
|
||||||
class="fas fa-info-circle"></i></label>
|
class="fas fa-info-circle"></i></label>
|
||||||
<input value="{{ old('minimum_credits') ?? -1 }}" id="minimum_credits"
|
<input value="{{ old('minimum_credits') ?? -1 }}" id="minimum_credits"
|
||||||
name="minimum_credits" type="number"
|
name="minimum_credits" type="number"
|
||||||
class="form-control @error('minimum_credits') is-invalid @enderror"
|
class="form-control @error('minimum_credits') is-invalid @enderror"
|
||||||
required="required">
|
required="required">
|
||||||
@error('minimum_credits')
|
@error('minimum_credits')
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{{ $message }}
|
{{ $message }}
|
||||||
</div>
|
</div>
|
||||||
@enderror
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="io">IO</label>
|
<label for="io">IO</label>
|
||||||
<input value="{{ old('io') ?? 500 }}" id="io" name="io" type="number"
|
<input value="{{$product->io ?? old('io') ?? 500}}" id="io" name="io"
|
||||||
class="form-control @error('io') is-invalid @enderror" required="required">
|
type="number"
|
||||||
|
class="form-control @error('io') is-invalid @enderror"
|
||||||
|
required="required">
|
||||||
@error('io')
|
@error('io')
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{{ $message }}
|
{{ $message }}
|
||||||
</div>
|
</div>
|
||||||
@enderror
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="databases">Databases</label>
|
<label for="databases">Databases</label>
|
||||||
<input value="{{ old('databases') ?? 1 }}" id="databases" name="databases"
|
<input value="{{$product->databases ?? old('databases') ?? 1}}"
|
||||||
type="number" class="form-control @error('databases') is-invalid @enderror"
|
id="databases"
|
||||||
required="required">
|
name="databases"
|
||||||
|
type="number"
|
||||||
|
class="form-control @error('databases') is-invalid @enderror"
|
||||||
|
required="required">
|
||||||
@error('databases')
|
@error('databases')
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{{ $message }}
|
{{ $message }}
|
||||||
</div>
|
</div>
|
||||||
@enderror
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="backups">Backups</label>
|
<label for="backups">Backups</label>
|
||||||
<input value="{{ old('backups') ?? 1 }}" id="backups" name="backups"
|
<input value="{{$product->backups ?? old('backups') ?? 1}}" id="backups"
|
||||||
type="number" class="form-control @error('backups') is-invalid @enderror"
|
name="backups"
|
||||||
required="required">
|
type="number"
|
||||||
|
class="form-control @error('backups') is-invalid @enderror"
|
||||||
|
required="required">
|
||||||
@error('backups')
|
@error('backups')
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{{ $message }}
|
{{ $message }}
|
||||||
</div>
|
</div>
|
||||||
@enderror
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="allocations">Allocations</label>
|
<label for="allocations">Allocations</label>
|
||||||
<input value="{{ old('allocations') ?? 0 }}" id="allocations"
|
<input value="{{$product->allocations ?? old('allocations') ?? 0}}"
|
||||||
name="allocations" type="number"
|
id="allocations" name="allocations"
|
||||||
class="form-control @error('allocations') is-invalid @enderror"
|
type="number"
|
||||||
required="required">
|
class="form-control @error('allocations') is-invalid @enderror"
|
||||||
|
required="required">
|
||||||
@error('allocations')
|
@error('allocations')
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{{ $message }}
|
{{ $message }}
|
||||||
</div>
|
</div>
|
||||||
@enderror
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -201,21 +223,88 @@
|
||||||
Submit
|
Submit
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="card-title">Product Linking
|
||||||
|
<i data-toggle="popover"
|
||||||
|
data-trigger="hover"
|
||||||
|
data-content="Link your products to nodes and eggs to create dynamic pricing for each option"
|
||||||
|
class="fas fa-info-circle"></i></h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="nodes">Nodes</label>
|
||||||
|
<select id="nodes" style="width:100%"
|
||||||
|
class="custom-select @error('nodes') is-invalid @enderror"
|
||||||
|
name="nodes[]" multiple="multiple" autocomplete="off">
|
||||||
|
@foreach($locations as $location)
|
||||||
|
<optgroup label="{{$location->name}}">
|
||||||
|
@foreach($location->nodes as $node)
|
||||||
|
<option
|
||||||
|
@if(isset($product)) @if($product->nodes->contains('id' , $node->id)) selected
|
||||||
|
@endif @endif value="{{$node->id}}">{{$node->name}}</option>
|
||||||
|
@endforeach
|
||||||
|
</optgroup>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
@error('nodes')
|
||||||
|
<div class="text-danger">
|
||||||
|
{{$message}}
|
||||||
|
</div>
|
||||||
|
@enderror
|
||||||
|
<div class="text-muted">
|
||||||
|
This product will only be available for these nodes
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="eggs">Eggs</label>
|
||||||
|
<select id="eggs" style="width:100%"
|
||||||
|
class="custom-select @error('eggs') is-invalid @enderror"
|
||||||
|
name="eggs[]" multiple="multiple" autocomplete="off">
|
||||||
|
@foreach($nests as $nest)
|
||||||
|
<optgroup label="{{$nest->name}}">
|
||||||
|
@foreach($nest->eggs as $egg)
|
||||||
|
<option
|
||||||
|
@if(isset($product)) @if($product->eggs->contains('id' , $egg->id)) selected
|
||||||
|
@endif @endif value="{{$egg->id}}">{{$egg->name}}</option>
|
||||||
|
@endforeach
|
||||||
|
</optgroup>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
@error('eggs')
|
||||||
|
<div class="text-danger">
|
||||||
|
{{$message}}
|
||||||
|
</div>
|
||||||
|
@enderror
|
||||||
|
<div class="text-muted">
|
||||||
|
This product will only be available for these eggs
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<!-- END CONTENT -->
|
<!-- END CONTENT -->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
$('[data-toggle="popover"]').popover();
|
$('[data-toggle="popover"]').popover();
|
||||||
|
$('.custom-select').select2();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<ol class="breadcrumb float-sm-right">
|
<ol class="breadcrumb float-sm-right">
|
||||||
<li class="breadcrumb-item"><a href="{{ route('home') }}">Dashboard</a></li>
|
<li class="breadcrumb-item"><a href="{{route('home')}}">Dashboard</a></li>
|
||||||
<li class="breadcrumb-item"><a href="{{ route('admin.products.index') }}">Products</a></li>
|
<li class="breadcrumb-item"><a href="{{route('admin.products.index')}}">Products</a></li>
|
||||||
<li class="breadcrumb-item"><a class="text-muted"
|
<li class="breadcrumb-item"><a class="text-muted"
|
||||||
href="{{ route('admin.products.edit', $product->id) }}">Edit</a>
|
href="{{route('admin.products.edit' , $product->id)}}">Edit</a>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
@ -25,31 +25,34 @@
|
||||||
<!-- MAIN CONTENT -->
|
<!-- MAIN CONTENT -->
|
||||||
<section class="content">
|
<section class="content">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
<form action="{{route('admin.products.update' , $product->id)}}" method="POST">
|
||||||
|
@csrf
|
||||||
|
@method('PATCH')
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
|
||||||
<div class="row">
|
@if($product->servers()->count() > 0)
|
||||||
<div class="col-lg-6">
|
<div class="callout callout-danger">
|
||||||
|
<h4>Editing the resource options will not automatically update the servers on
|
||||||
|
pterodactyl's side!</h4>
|
||||||
|
<p class="text-muted">Automatically updating resource options on pterodactyl side is on
|
||||||
|
my todo list :)</p>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
@if ($product->servers()->count() > 0)
|
<div class="card">
|
||||||
<div class="callout callout-danger">
|
<div class="card-header">
|
||||||
<h4>Editing the resource options will not automatically update the servers on pterodactyl's
|
<h5 class="card-title">Product Details</h5>
|
||||||
side!</h4>
|
</div>
|
||||||
<p class="text-muted">Automatically updating resource options on pterodactyl side is on my
|
<div class="card-body">
|
||||||
todo list :)</p>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
<form action="{{ route('admin.products.update', $product->id) }}" method="POST">
|
|
||||||
@csrf
|
|
||||||
@method('PATCH')
|
|
||||||
<div class="d-flex flex-row-reverse">
|
<div class="d-flex flex-row-reverse">
|
||||||
<div class="custom-control custom-switch">
|
<div class="custom-control custom-switch">
|
||||||
<input type="checkbox" @if ($product->disabled) checked @endif name="disabled"
|
<input type="checkbox" @if($product->disabled) checked @endif name="disabled"
|
||||||
class="custom-control-input custom-control-input-danger" id="switch1">
|
class="custom-control-input custom-control-input-danger" id="switch1">
|
||||||
<label class="custom-control-label" for="switch1">Disabled <i data-toggle="popover"
|
<label class="custom-control-label" for="switch1">Disabled <i
|
||||||
data-trigger="hover"
|
data-toggle="popover" data-trigger="hover"
|
||||||
data-content="Will hide this option from being selected"
|
data-content="Will hide this option from being selected"
|
||||||
class="fas fa-info-circle"></i></label>
|
class="fas fa-info-circle"></i></label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -57,6 +60,7 @@
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="name">Name</label>
|
<label for="name">Name</label>
|
||||||
<input value="{{ $product->name }}" id="name" name="name" type="text"
|
<input value="{{ $product->name }}" id="name" name="name" type="text"
|
||||||
|
@ -118,11 +122,13 @@
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="description">Description <i data-toggle="popover"
|
<label for="description">Description <i data-toggle="popover"
|
||||||
data-trigger="hover" data-content="This is what the users sees"
|
data-trigger="hover"
|
||||||
class="fas fa-info-circle"></i></label>
|
data-content="This is what the users sees"
|
||||||
<textarea id="description" name="description" type="text"
|
class="fas fa-info-circle"></i></label>
|
||||||
class="form-control @error('description') is-invalid @enderror"
|
<textarea id="description" name="description"
|
||||||
required="required">{{ $product->description }}</textarea>
|
type="text"
|
||||||
|
class="form-control @error('description') is-invalid @enderror"
|
||||||
|
required="required">{{$product->description}}</textarea>
|
||||||
@error('description')
|
@error('description')
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{{ $message }}
|
{{ $message }}
|
||||||
|
@ -210,21 +216,89 @@
|
||||||
Submit
|
Submit
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="card-title">Product Linking
|
||||||
|
<i data-toggle="popover"
|
||||||
|
data-trigger="hover"
|
||||||
|
data-content="Link your products to nodes and eggs to create dynamic pricing for each option"
|
||||||
|
class="fas fa-info-circle"></i></h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="nodes">Nodes</label>
|
||||||
|
<select id="nodes" style="width:100%"
|
||||||
|
class="custom-select @error('nodes') is-invalid @enderror" name="nodes[]"
|
||||||
|
multiple="multiple" autocomplete="off">
|
||||||
|
@foreach($locations as $location)
|
||||||
|
<optgroup label="{{$location->name}}">
|
||||||
|
@foreach($location->nodes as $node)
|
||||||
|
<option @if($product->nodes->contains('id' , $node->id)) selected
|
||||||
|
@endif value="{{$node->id}}">{{$node->name}}</option>
|
||||||
|
@endforeach
|
||||||
|
</optgroup>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
@error('nodes')
|
||||||
|
<div class="text-danger">
|
||||||
|
{{$message}}
|
||||||
|
</div>
|
||||||
|
@enderror
|
||||||
|
<div class="text-muted">
|
||||||
|
This product will only be available for these nodes
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="eggs">Eggs</label>
|
||||||
|
<select id="eggs" style="width:100%"
|
||||||
|
class="custom-select @error('eggs') is-invalid @enderror" name="eggs[]"
|
||||||
|
multiple="multiple" autocomplete="off">
|
||||||
|
@foreach($nests as $nest)
|
||||||
|
<optgroup label="{{$nest->name}}">
|
||||||
|
@foreach($nest->eggs as $egg)
|
||||||
|
<option @if($product->eggs->contains('id' , $egg->id)) selected
|
||||||
|
@endif value="{{$egg->id}}">{{$egg->name}}</option>
|
||||||
|
@endforeach
|
||||||
|
</optgroup>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
@error('eggs')
|
||||||
|
<div class="text-danger">
|
||||||
|
{{$message}}
|
||||||
|
</div>
|
||||||
|
@enderror
|
||||||
|
<div class="text-muted">
|
||||||
|
This product will only be available for these eggs
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<!-- END CONTENT -->
|
<!-- END CONTENT -->
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', (event) => {
|
||||||
|
$('.custom-select').select2();
|
||||||
|
})
|
||||||
|
</script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
$('[data-toggle="popover"]').popover();
|
$('[data-toggle="popover"]').popover();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
@ -46,10 +46,10 @@
|
||||||
<th>Cpu</th>
|
<th>Cpu</th>
|
||||||
<th>Swap</th>
|
<th>Swap</th>
|
||||||
<th>Disk</th>
|
<th>Disk</th>
|
||||||
<th>IO</th>
|
|
||||||
<th>Databases</th>
|
<th>Databases</th>
|
||||||
<th>Backups</th>
|
<th>Backups</th>
|
||||||
<th>Allocations</th>
|
<th>Eggs</th>
|
||||||
|
<th>Nodes</th>
|
||||||
<th>Servers</th>
|
<th>Servers</th>
|
||||||
<th>Created at</th>
|
<th>Created at</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
|
@ -79,6 +79,7 @@
|
||||||
processing: true,
|
processing: true,
|
||||||
serverSide: true,
|
serverSide: true,
|
||||||
stateSave: true,
|
stateSave: true,
|
||||||
|
order: [[ 2, "asc" ]],
|
||||||
ajax: "{{route('admin.products.datatable')}}",
|
ajax: "{{route('admin.products.datatable')}}",
|
||||||
columns: [
|
columns: [
|
||||||
{data: 'disabled'},
|
{data: 'disabled'},
|
||||||
|
@ -88,10 +89,10 @@
|
||||||
{data: 'cpu'},
|
{data: 'cpu'},
|
||||||
{data: 'swap'},
|
{data: 'swap'},
|
||||||
{data: 'disk'},
|
{data: 'disk'},
|
||||||
{data: 'io'},
|
|
||||||
{data: 'databases'},
|
{data: 'databases'},
|
||||||
{data: 'backups'},
|
{data: 'backups'},
|
||||||
{data: 'allocations'},
|
{data: 'nodes', sortable: false},
|
||||||
|
{data: 'eggs', sortable: false},
|
||||||
{data: 'servers', sortable: false},
|
{data: 'servers', sortable: false},
|
||||||
{data: 'created_at'},
|
{data: 'created_at'},
|
||||||
{data: 'actions', sortable: false},
|
{data: 'actions', sortable: false},
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
href="{{\Illuminate\Support\Facades\Storage::disk('public')->exists('favicon.ico') ? asset('storage/favicon.ico') : asset('favicon.ico')}}"
|
href="{{\Illuminate\Support\Facades\Storage::disk('public')->exists('favicon.ico') ? asset('storage/favicon.ico') : asset('favicon.ico')}}"
|
||||||
type="image/x-icon">
|
type="image/x-icon">
|
||||||
|
|
||||||
|
<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
||||||
|
|
||||||
{{-- <link rel="stylesheet" href="{{asset('css/adminlte.min.css')}}">--}}
|
{{-- <link rel="stylesheet" href="{{asset('css/adminlte.min.css')}}">--}}
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs4/dt-1.10.24/datatables.min.css"/>
|
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs4/dt-1.10.24/datatables.min.css"/>
|
||||||
|
|
||||||
|
@ -76,11 +78,33 @@
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-item dropdown">
|
||||||
|
<a class="nav-link" href="#" id="userDropdown" role="button" data-toggle="dropdown"
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-expanded="false">
|
||||||
|
<span class="mr-1 d-lg-inline text-gray-600">
|
||||||
|
<small><i class="fas fa-coins mr-2"></i></small>{{Auth::user()->credits()}}
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
|
||||||
|
<a class="dropdown-item" href="{{route('store.index')}}">
|
||||||
|
<i class="fas fa-coins fa-sm fa-fw mr-2 text-gray-400"></i>
|
||||||
|
{{__('Store')}}
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item" data-toggle="modal" data-target="#redeemVoucherModal"
|
||||||
|
href="javascript:void(0)">
|
||||||
|
<i class="fas fa-money-check-alt fa-sm fa-fw mr-2 text-gray-400"></i>
|
||||||
|
{{__('Redeem code')}}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li class="nav-item dropdown no-arrow">
|
<li class="nav-item dropdown no-arrow">
|
||||||
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown"
|
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown"
|
||||||
aria-haspopup="true"
|
aria-haspopup="true"
|
||||||
aria-expanded="false">
|
aria-expanded="false">
|
||||||
<span class="mr-1 d-none d-lg-inline text-gray-600 small">
|
<span class="mr-1 d-lg-inline text-gray-600 small">
|
||||||
{{Auth::user()->name}}
|
{{Auth::user()->name}}
|
||||||
<img width="28px" height="28px" class="rounded-circle ml-1" src="{{Auth::user()->getAvatar()}}">
|
<img width="28px" height="28px" class="rounded-circle ml-1" src="{{Auth::user()->getAvatar()}}">
|
||||||
</span>
|
</span>
|
||||||
|
@ -102,11 +126,6 @@
|
||||||
Log back in
|
Log back in
|
||||||
</a>
|
</a>
|
||||||
@endif
|
@endif
|
||||||
<a class="dropdown-item" data-toggle="modal" data-target="#redeemVoucherModal"
|
|
||||||
href="javascript:void(0)">
|
|
||||||
<i class="fas fa-money-check-alt fa-sm fa-fw mr-2 text-gray-400"></i>
|
|
||||||
Redeem code
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<form method="post" action="{{route('logout')}}">
|
<form method="post" action="{{route('logout')}}">
|
||||||
@csrf
|
@csrf
|
||||||
|
@ -210,47 +229,34 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="nav-header">Pterodactyl</li>
|
{{-- <li class="nav-header">Pterodactyl</li>--}}
|
||||||
|
|
||||||
<li class="nav-item">
|
{{-- <li class="nav-item">--}}
|
||||||
<a href="{{route('admin.nodes.index')}}"
|
{{-- <a href="{{route('admin.nodes.index')}}"--}}
|
||||||
class="nav-link @if(Request::routeIs('admin.nodes.*')) active @endif">
|
{{-- class="nav-link @if(Request::routeIs('admin.nodes.*')) active @endif">--}}
|
||||||
<i class="nav-icon fas fa-sitemap"></i>
|
{{-- <i class="nav-icon fas fa-sitemap"></i>--}}
|
||||||
<p>Nodes</p>
|
{{-- <p>Nodes</p>--}}
|
||||||
</a>
|
{{-- </a>--}}
|
||||||
</li>
|
{{-- </li>--}}
|
||||||
|
|
||||||
<li class="nav-item">
|
|
||||||
<a href="{{route('admin.nests.index')}}"
|
|
||||||
class="nav-link @if(Request::routeIs('admin.nests.*')) active @endif">
|
|
||||||
<i class="nav-icon fas fa-th-large"></i>
|
|
||||||
<p>Nests</p>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-header">Logs</li>
|
|
||||||
|
|
||||||
<li class="nav-item">
|
|
||||||
<a href="{{route('admin.payments.index')}}"
|
|
||||||
class="nav-link @if(Request::routeIs('admin.payments.*')) active @endif">
|
|
||||||
<i class="nav-icon fas fa-money-bill-wave"></i>
|
|
||||||
<p>Payments
|
|
||||||
<span class="badge badge-success right">{{\App\Models\Payment::count()}}</span>
|
|
||||||
</p>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item">
|
|
||||||
<a href="{{route('admin.activitylogs.index')}}"
|
|
||||||
class="nav-link @if(Request::routeIs('admin.activitylogs.*')) active @endif">
|
|
||||||
<i class="nav-icon fas fa-clipboard-list"></i>
|
|
||||||
<p>Activity Logs</p>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
|
{{-- <li class="nav-item">--}}
|
||||||
|
{{-- <a href="{{route('admin.nests.index')}}"--}}
|
||||||
|
{{-- class="nav-link @if(Request::routeIs('admin.nests.*')) active @endif">--}}
|
||||||
|
{{-- <i class="nav-icon fas fa-th-large"></i>--}}
|
||||||
|
{{-- <p>Nests</p>--}}
|
||||||
|
{{-- </a>--}}
|
||||||
|
{{-- </li>--}}
|
||||||
|
|
||||||
<li class="nav-header">Dashboard</li>
|
<li class="nav-header">Dashboard</li>
|
||||||
|
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="{{route('admin.overview.index')}}"
|
||||||
|
class="nav-link @if(Request::routeIs('admin.overview.*')) active @endif">
|
||||||
|
<i class="nav-icon fa fa-gamepad"></i>
|
||||||
|
<p>Overview</p>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="{{route('admin.api.index')}}"
|
<a href="{{route('admin.api.index')}}"
|
||||||
class="nav-link @if(Request::routeIs('admin.api.*')) active @endif">
|
class="nav-link @if(Request::routeIs('admin.api.*')) active @endif">
|
||||||
|
@ -285,6 +291,26 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-header">Logs</li>
|
||||||
|
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="{{route('admin.payments.index')}}"
|
||||||
|
class="nav-link @if(Request::routeIs('admin.payments.*')) active @endif">
|
||||||
|
<i class="nav-icon fas fa-money-bill-wave"></i>
|
||||||
|
<p>Payments
|
||||||
|
<span class="badge badge-success right">{{\App\Models\Payment::count()}}</span>
|
||||||
|
</p>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="{{route('admin.activitylogs.index')}}"
|
||||||
|
class="nav-link @if(Request::routeIs('admin.activitylogs.*')) active @endif">
|
||||||
|
<i class="nav-icon fas fa-clipboard-list"></i>
|
||||||
|
<p>Activity Logs</p>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -340,6 +366,8 @@
|
||||||
<script type="text/javascript" src="https://cdn.datatables.net/v/bs4/dt-1.10.24/datatables.min.js"></script>
|
<script type="text/javascript" src="https://cdn.datatables.net/v/bs4/dt-1.10.24/datatables.min.js"></script>
|
||||||
<!-- Summernote -->
|
<!-- Summernote -->
|
||||||
<script src="{{asset('plugins/summernote/summernote-bs4.min.js')}}"></script>
|
<script src="{{asset('plugins/summernote/summernote-bs4.min.js')}}"></script>
|
||||||
|
<!-- select2 -->
|
||||||
|
<script src="{{asset('plugins/select2/js/select2.min.js')}}"></script>
|
||||||
|
|
||||||
<!-- Moment.js -->
|
<!-- Moment.js -->
|
||||||
<script src="{{asset('plugins/moment/moment.min.js')}}"></script>
|
<script src="{{asset('plugins/moment/moment.min.js')}}"></script>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<li class="breadcrumb-item"><a href="{{ route('home') }}">Dashboard</a></li>
|
<li class="breadcrumb-item"><a href="{{ route('home') }}">Dashboard</a></li>
|
||||||
<li class="breadcrumb-item"><a href="{{ route('servers.index') }}">Servers</a>
|
<li class="breadcrumb-item"><a href="{{ route('servers.index') }}">Servers</a>
|
||||||
<li class="breadcrumb-item"><a class="text-muted"
|
<li class="breadcrumb-item"><a class="text-muted"
|
||||||
href="{{ route('servers.create') }}">Create</a>
|
href="{{ route('servers.create') }}">Create</a>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
@ -23,130 +23,377 @@
|
||||||
<!-- END CONTENT HEADER -->
|
<!-- END CONTENT HEADER -->
|
||||||
|
|
||||||
<!-- MAIN CONTENT -->
|
<!-- MAIN CONTENT -->
|
||||||
<section class="content">
|
<section x-data="serverApp()" class="content">
|
||||||
<div class="container-fluid">
|
<div class="container">
|
||||||
|
|
||||||
|
<!-- FORM -->
|
||||||
|
<form action="{{route('servers.store')}}" method="post" class="row">
|
||||||
|
@csrf
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="card-title"><i class="fas fa-cogs mr-2"></i>{{__('Server configuration')}}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if($productCount === 0 || $nodeCount === 0 || count($nests) === 0 || count($eggs) === 0 )
|
||||||
|
<div class="alert alert-danger p-2 m-2">
|
||||||
|
<h5><i class="icon fas fa-exclamation-circle"></i>{{__('Error!')}}</h5>
|
||||||
|
<p class="pl-4">
|
||||||
|
{{__('Make sure to link your products to nodes and eggs.')}} <br>
|
||||||
|
{{__('There has to be at least 1 valid product for server creation')}}
|
||||||
|
</p>
|
||||||
|
<ul>
|
||||||
|
@if($productCount === 0 )
|
||||||
|
<li> {{__('No products available!')}}</li>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if($nodeCount === 0 )
|
||||||
|
<li>{{__('No nodes have been linked!')}}</li>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if(count($nests) === 0 )
|
||||||
|
<li>{{__('No nests available!')}}</li>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if(count($eggs) === 0 )
|
||||||
|
<li>{{__('No eggs have been linked!')}}</li>
|
||||||
|
@endif
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
|
||||||
|
<div x-show="loading" class="overlay dark">
|
||||||
|
<i class="fas fa-2x fa-sync-alt"></i>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
@if ($errors->any())
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<ul class="list-group pl-3">
|
||||||
|
@foreach ($errors->all() as $error)
|
||||||
|
<li>{{ $error }}</li>
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<!-- CUSTOM CONTENT -->
|
|
||||||
<div class="row justify-content-center">
|
|
||||||
<div class="card col-lg-8 col-md-12 mb-5">
|
|
||||||
<div class="card-header">
|
|
||||||
<h5 class="card-title"><i class="fa fa-server mr-2"></i>Create Server</h5>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<form method="post" action="{{ route('servers.store') }}">
|
|
||||||
@csrf
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="name">* Name</label>
|
<label for="name">{{__('Name')}}</label>
|
||||||
<input id="name" name="name" type="text" required="required"
|
<input x-model="name" id="name" name="name" type="text" required="required"
|
||||||
class="form-control @error('name') is-invalid @enderror">
|
class="form-control @error('name') is-invalid @enderror">
|
||||||
|
|
||||||
@error('name')
|
@error('name')
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
Please fill out this field.
|
{{ $message }}
|
||||||
</div>
|
</div>
|
||||||
@enderror
|
@enderror
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<label for="description">Description</label>
|
|
||||||
<input id="description" name="description" type="text"
|
|
||||||
class="form-control @error('description') is-invalid @enderror">
|
|
||||||
|
|
||||||
@error('description')
|
<div class="row">
|
||||||
<div class="invalid-feedback">
|
<div class="col-md-6">
|
||||||
Please fill out this field.
|
<div class="form-group">
|
||||||
|
<label for="nest">{{__('Software')}}</label>
|
||||||
|
<select class="custom-select"
|
||||||
|
required
|
||||||
|
name="nest"
|
||||||
|
id="nest"
|
||||||
|
x-model="selectedNest"
|
||||||
|
@change="setNests();">
|
||||||
|
<option selected disabled hidden
|
||||||
|
value="null">{{count($nests) > 0 ? __('Please select software..') : __('---')}}</option>
|
||||||
|
@foreach ($nests as $nest)
|
||||||
|
<option value="{{ $nest->id }}">{{ $nest->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@enderror
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="location_id">* Server location</label>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
<select id="node_id" name="node_id" required="required"
|
|
||||||
class="custom-select @error('node_id') is-invalid @enderror">
|
|
||||||
<option selected disabled hidden value="">Please Select ...</option>
|
|
||||||
@foreach ($locations as $location)
|
|
||||||
<optgroup label="{{ $location->name }}">
|
|
||||||
@foreach ($location->nodes as $node)
|
|
||||||
@if (!$node->disabled)
|
|
||||||
<option value="{{ $node->id }}">{{ $node->name }}</option>
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
</optgroup>
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@error('node_id')
|
<div class="col-md-6">
|
||||||
<div class="invalid-feedback">
|
<div class="form-group">
|
||||||
Please fill out this field.
|
<label for="egg">{{__('Configuration')}}</label>
|
||||||
|
<div>
|
||||||
|
<select id="egg"
|
||||||
|
required
|
||||||
|
name="egg"
|
||||||
|
:disabled="eggs.length == 0"
|
||||||
|
x-model="selectedEgg"
|
||||||
|
@change="fetchNodes();"
|
||||||
|
required="required"
|
||||||
|
class="custom-select">
|
||||||
|
<option x-text="getEggInputText()"
|
||||||
|
selected disabled hidden value="null"></option>
|
||||||
|
<template x-for="egg in eggs" :key="egg.id">
|
||||||
|
<option x-text="egg.name" :value="egg.id"></option>
|
||||||
|
</template>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="egg_id">* Server configuration</label>
|
|
||||||
<div>
|
|
||||||
<select id="egg_id" name="egg_id" required="required"
|
|
||||||
class="custom-select @error('egg_id') is-invalid @enderror">
|
|
||||||
<option selected disabled hidden value="">Please Select ...</option>
|
|
||||||
@foreach ($nests as $nest)
|
|
||||||
<optgroup label="{{ $nest->name }}">
|
|
||||||
@foreach ($nest->eggs as $egg)
|
|
||||||
<option value="{{ $egg->id }}">{{ $egg->name }}</option>
|
|
||||||
@endforeach
|
|
||||||
</optgroup>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@error('egg_id')
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
Please fill out this field.
|
|
||||||
</div>
|
|
||||||
@enderror
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="product_id">* Resource Configuration</label>
|
<label for="node">{{__('Node')}}</label>
|
||||||
<div>
|
<select name="node"
|
||||||
<select id="product_id" name="product_id" required="required"
|
required
|
||||||
class="custom-select @error('product_id') is-invalid @enderror">
|
id="node"
|
||||||
<option selected disabled hidden value="">Please Select...</option>
|
x-model="selectedNode"
|
||||||
@foreach ($products as $product)
|
:disabled="!fetchedNodes"
|
||||||
<option value="{{ $product->id }}" @if ($product->minimum_credits == -1 && Auth::user()->credits >= $minimum_credits)
|
@change="fetchProducts();"
|
||||||
@elseif ($product->minimum_credits != -1 && Auth::user()->credits >=
|
class="custom-select">
|
||||||
$product->minimum_credits)
|
<option
|
||||||
@else
|
x-text="getNodeInputText()"
|
||||||
disabled
|
disabled selected hidden value="null"></option>
|
||||||
@endif
|
<template x-for="node in nodes" :key="node.id">
|
||||||
>{{ $product->name }}
|
<option x-text="node.name" :value="node.id"></option>
|
||||||
({{ $product->description }})
|
</template>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="product">{{__('Resources')}}</label>
|
||||||
|
<select name="product"
|
||||||
|
required
|
||||||
|
id="product"
|
||||||
|
:disabled="!fetchedProducts"
|
||||||
|
x-model="selectedProduct"
|
||||||
|
@change="updateSelectedObjects()"
|
||||||
|
class="custom-select">
|
||||||
|
<option
|
||||||
|
x-text="getProductInputText()"
|
||||||
|
disabled selected hidden value="null"></option>
|
||||||
|
<template x-for="product in products" :key="product.id">
|
||||||
|
<option :disabled="product.minimum_credits > user.credits"
|
||||||
|
x-text="getProductOptionText(product)"
|
||||||
|
:value="product.id">
|
||||||
</option>
|
</option>
|
||||||
@endforeach
|
</template>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
|
|
||||||
@error('product_id')
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
Please fill out this field.
|
|
||||||
</div>
|
|
||||||
@enderror
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group text-right">
|
|
||||||
<input type="submit" class="btn btn-primary mt-3" value="Submit"
|
|
||||||
onclick="this.disabled=true;this.value='Creating, please wait...';this.form.submit();">
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-md-4 mb-4">
|
||||||
<!-- END CUSTOM CONTENT -->
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="card-title">
|
||||||
|
<i class="fas fa-list mr-2"></i>{{__('Server details')}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
<ul class="list-group mb-3">
|
||||||
|
<li x-show="selectedNestObject.name"
|
||||||
|
class="list-group-item d-flex justify-content-between lh-condensed">
|
||||||
|
<div>
|
||||||
|
<h6 class="my-0">{{__('Software')}}</h6>
|
||||||
|
<small x-text="selectedNestObject?.name ?? '{{__('No selection')}}'"
|
||||||
|
class="text-muted"></small>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item d-flex justify-content-between lh-condensed">
|
||||||
|
<div>
|
||||||
|
<h6 class="my-0">{{__('Configuration')}}</h6>
|
||||||
|
<small x-text="selectedEggObject?.name ?? '{{__('No selection')}}'"
|
||||||
|
class="text-muted"></small>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
class="list-group-item d-flex justify-content-between lh-condensed">
|
||||||
|
<div>
|
||||||
|
<h6 class="my-0">{{__('Node')}}</h6>
|
||||||
|
<small x-text="selectedNodeObject?.name ?? '{{__('No selection')}}'"
|
||||||
|
class="text-muted"></small>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
class="list-group-item d-flex justify-content-between lh-condensed">
|
||||||
|
<div>
|
||||||
|
<h6 class="my-0">{{__('Resources')}}</h6>
|
||||||
|
<small x-text="selectedProductObject?.name ?? '{{__('No selection')}}'"
|
||||||
|
class="text-muted"></small>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="list-group mb-3">
|
||||||
|
<li class="list-group-item d-flex justify-content-between">
|
||||||
|
<span>{{CREDITS_DISPLAY_NAME}} {{__('per month')}}</span>
|
||||||
|
<strong>
|
||||||
|
<i x-show="selectedProductObject?.price" class="fas fa-coins"></i>
|
||||||
|
<span x-text="selectedProductObject?.price ?? ''"></span>
|
||||||
|
</strong>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<button :disabled="!isFormValid()" :class="isFormValid() ? '' : 'disabled'"
|
||||||
|
class="btn btn-primary btn-block">
|
||||||
|
{{__('Create server')}}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<!-- END FORM -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<!-- END CONTENT -->
|
<!-- END CONTENT -->
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function serverApp() {
|
||||||
|
return {
|
||||||
|
//loading
|
||||||
|
loading: false,
|
||||||
|
fetchedNodes: false,
|
||||||
|
fetchedProducts: false,
|
||||||
|
|
||||||
|
//input fields
|
||||||
|
name: null,
|
||||||
|
selectedNest: null,
|
||||||
|
selectedEgg: null,
|
||||||
|
selectedNode: null,
|
||||||
|
selectedProduct: null,
|
||||||
|
|
||||||
|
//selected objects based on input
|
||||||
|
selectedNestObject: {},
|
||||||
|
selectedEggObject: {},
|
||||||
|
selectedNodeObject: {},
|
||||||
|
selectedProductObject: {},
|
||||||
|
|
||||||
|
//values
|
||||||
|
user: {!! $user !!},
|
||||||
|
nests: {!! $nests !!},
|
||||||
|
eggsSave:{!! $eggs !!}, //store back-end eggs
|
||||||
|
eggs: [],
|
||||||
|
nodes: [],
|
||||||
|
products: [],
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description set available eggs based on the selected nest
|
||||||
|
* @note called whenever a nest is selected
|
||||||
|
* @see selectedNest
|
||||||
|
*/
|
||||||
|
setNests() {
|
||||||
|
this.fetchedNodes = false;
|
||||||
|
this.fetchedProducts = false;
|
||||||
|
this.nodes = [];
|
||||||
|
this.products = [];
|
||||||
|
this.selectedEgg = 'null';
|
||||||
|
this.selectedNode = 'null';
|
||||||
|
this.selectedProduct = 'null';
|
||||||
|
|
||||||
|
this.eggs = this.eggsSave.filter(egg => egg.nest_id == this.selectedNest)
|
||||||
|
this.updateSelectedObjects()
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description fetch all available locations based on the selected egg
|
||||||
|
* @note called whenever a server configuration is selected
|
||||||
|
* @see selectedEg
|
||||||
|
*/
|
||||||
|
async fetchNodes() {
|
||||||
|
this.loading = true;
|
||||||
|
this.fetchedNodes = false;
|
||||||
|
this.fetchedProducts = false;
|
||||||
|
this.nodes = [];
|
||||||
|
this.products = [];
|
||||||
|
this.selectedNode = 'null';
|
||||||
|
this.selectedProduct = 'null';
|
||||||
|
|
||||||
|
let response = await axios.get(`{{route('products.nodes.egg')}}/${this.selectedEgg}`)
|
||||||
|
.catch(console.error)
|
||||||
|
|
||||||
|
this.fetchedNodes = true;
|
||||||
|
this.nodes = response.data
|
||||||
|
this.loading = false;
|
||||||
|
this.updateSelectedObjects()
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description fetch all available products based on the selected node
|
||||||
|
* @note called whenever a node is selected
|
||||||
|
* @see selectedNode
|
||||||
|
*/
|
||||||
|
async fetchProducts() {
|
||||||
|
this.loading = true;
|
||||||
|
this.fetchedProducts = false;
|
||||||
|
this.products = [];
|
||||||
|
this.selectedProduct = 'null';
|
||||||
|
|
||||||
|
let response = await axios.get(`{{route('products.products.node')}}/${this.selectedNode}`)
|
||||||
|
.catch(console.error)
|
||||||
|
|
||||||
|
this.fetchedProducts = true;
|
||||||
|
this.products = response.data
|
||||||
|
this.loading = false;
|
||||||
|
this.updateSelectedObjects()
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description map selected id's to selected objects
|
||||||
|
* @note being used in the server info box
|
||||||
|
*/
|
||||||
|
updateSelectedObjects() {
|
||||||
|
this.selectedNestObject = this.nests.find(nest => nest.id == this.selectedNest) ?? {}
|
||||||
|
this.selectedEggObject = this.eggs.find(egg => egg.id == this.selectedEgg) ?? {}
|
||||||
|
this.selectedNodeObject = this.nodes.find(node => node.id == this.selectedNode) ?? {}
|
||||||
|
this.selectedProductObject = this.products.find(product => product.id == this.selectedProduct) ?? {}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description check if all options are selected
|
||||||
|
* @return {boolean}
|
||||||
|
*/
|
||||||
|
isFormValid() {
|
||||||
|
if (Object.keys(this.selectedNestObject).length === 0) return false;
|
||||||
|
if (Object.keys(this.selectedEggObject).length === 0) return false;
|
||||||
|
if (Object.keys(this.selectedNodeObject).length === 0) return false;
|
||||||
|
if (Object.keys(this.selectedProductObject).length === 0) return false;
|
||||||
|
return !!this.name;
|
||||||
|
},
|
||||||
|
|
||||||
|
getNodeInputText() {
|
||||||
|
if (this.fetchedNodes) {
|
||||||
|
if (this.nodes.length > 0) {
|
||||||
|
return '{{__('Please select a node...')}}';
|
||||||
|
}
|
||||||
|
return '{{__('No nodes found matching current configuration')}}'
|
||||||
|
}
|
||||||
|
return '{{__('---')}}';
|
||||||
|
},
|
||||||
|
|
||||||
|
getProductInputText() {
|
||||||
|
if (this.fetchedProducts) {
|
||||||
|
if (this.products.length > 0) {
|
||||||
|
return '{{__('Please select a resource...')}}';
|
||||||
|
}
|
||||||
|
return '{{__('No resources found matching current configuration')}}'
|
||||||
|
}
|
||||||
|
return '{{__('---')}}';
|
||||||
|
},
|
||||||
|
|
||||||
|
getEggInputText() {
|
||||||
|
if (this.selectedNest) {
|
||||||
|
return '{{__('Please select a configuration...')}}';
|
||||||
|
}
|
||||||
|
return '{{__('---')}}';
|
||||||
|
},
|
||||||
|
|
||||||
|
getProductOptionText(product){
|
||||||
|
let text = product.name + ' (' + product.description + ')';
|
||||||
|
|
||||||
|
if (product.minimum_credits > this.user.credits){
|
||||||
|
return '{{__('Not enough credits!')}} | ' + text;
|
||||||
|
}
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
use App\Http\Controllers\Admin\ActivityLogController;
|
use App\Http\Controllers\Admin\ActivityLogController;
|
||||||
use App\Http\Controllers\Admin\ApplicationApiController;
|
use App\Http\Controllers\Admin\ApplicationApiController;
|
||||||
use App\Http\Controllers\Admin\ConfigurationController;
|
use App\Http\Controllers\Admin\ConfigurationController;
|
||||||
use App\Http\Controllers\Admin\NestsController;
|
use App\Http\Controllers\Admin\OverViewController;
|
||||||
use App\Http\Controllers\Admin\NodeController;
|
|
||||||
use App\Http\Controllers\Admin\PaymentController;
|
use App\Http\Controllers\Admin\PaymentController;
|
||||||
use App\Http\Controllers\Admin\PaypalProductController;
|
use App\Http\Controllers\Admin\PaypalProductController;
|
||||||
use App\Http\Controllers\Admin\ProductController;
|
use App\Http\Controllers\Admin\ProductController;
|
||||||
|
@ -16,6 +15,7 @@ use App\Http\Controllers\Admin\VoucherController;
|
||||||
use App\Http\Controllers\Auth\SocialiteController;
|
use App\Http\Controllers\Auth\SocialiteController;
|
||||||
use App\Http\Controllers\HomeController;
|
use App\Http\Controllers\HomeController;
|
||||||
use App\Http\Controllers\NotificationController;
|
use App\Http\Controllers\NotificationController;
|
||||||
|
use App\Http\Controllers\ProductController as FrontProductController;
|
||||||
use App\Http\Controllers\ProfileController;
|
use App\Http\Controllers\ProfileController;
|
||||||
use App\Http\Controllers\ServerController;
|
use App\Http\Controllers\ServerController;
|
||||||
use App\Http\Controllers\StoreController;
|
use App\Http\Controllers\StoreController;
|
||||||
|
@ -54,6 +54,11 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
|
||||||
Route::resource('profile', ProfileController::class);
|
Route::resource('profile', ProfileController::class);
|
||||||
Route::resource('store', StoreController::class);
|
Route::resource('store', StoreController::class);
|
||||||
|
|
||||||
|
#server create utility routes (product)
|
||||||
|
#routes made for server create page to fetch product info
|
||||||
|
Route::get('/products/nodes/egg/{egg?}', [FrontProductController::class, 'getNodesBasedOnEgg'])->name('products.nodes.egg');
|
||||||
|
Route::get('/products/products/node/{node?}', [FrontProductController::class, 'getProductsBasedOnNode'])->name('products.products.node');
|
||||||
|
|
||||||
#payments
|
#payments
|
||||||
Route::get('checkout/{paypalProduct}', [PaymentController::class, 'checkOut'])->name('checkout');
|
Route::get('checkout/{paypalProduct}', [PaymentController::class, 'checkOut'])->name('checkout');
|
||||||
Route::get('payment/success', [PaymentController::class, 'success'])->name('payment.success');
|
Route::get('payment/success', [PaymentController::class, 'success'])->name('payment.success');
|
||||||
|
@ -72,6 +77,9 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
|
||||||
#admin
|
#admin
|
||||||
Route::prefix('admin')->name('admin.')->middleware('admin')->group(function () {
|
Route::prefix('admin')->name('admin.')->middleware('admin')->group(function () {
|
||||||
|
|
||||||
|
Route::get('overview', [OverViewController::class, 'index'])->name('overview.index');
|
||||||
|
Route::get('overview/sync', [OverViewController::class, 'syncPterodactyl'])->name('overview.sync');
|
||||||
|
|
||||||
Route::resource('activitylogs', ActivityLogController::class);
|
Route::resource('activitylogs', ActivityLogController::class);
|
||||||
|
|
||||||
Route::get("users.json", [UserController::class, "json"])->name('users.json');
|
Route::get("users.json", [UserController::class, "json"])->name('users.json');
|
||||||
|
@ -87,6 +95,7 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
|
||||||
Route::resource('servers', AdminServerController::class);
|
Route::resource('servers', AdminServerController::class);
|
||||||
|
|
||||||
Route::get('products/datatable', [ProductController::class, 'datatable'])->name('products.datatable');
|
Route::get('products/datatable', [ProductController::class, 'datatable'])->name('products.datatable');
|
||||||
|
Route::get('products/clone/{product}', [ProductController::class, 'clone'])->name('products.clone');
|
||||||
Route::patch('products/disable/{product}', [ProductController::class, 'disable'])->name('products.disable');
|
Route::patch('products/disable/{product}', [ProductController::class, 'disable'])->name('products.disable');
|
||||||
Route::resource('products', ProductController::class);
|
Route::resource('products', ProductController::class);
|
||||||
|
|
||||||
|
@ -99,13 +108,13 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
|
||||||
Route::get('payments/datatable', [PaymentController::class, 'datatable'])->name('payments.datatable');
|
Route::get('payments/datatable', [PaymentController::class, 'datatable'])->name('payments.datatable');
|
||||||
Route::get('payments', [PaymentController::class, 'index'])->name('payments.index');
|
Route::get('payments', [PaymentController::class, 'index'])->name('payments.index');
|
||||||
|
|
||||||
Route::get('nodes/datatable', [NodeController::class, 'datatable'])->name('nodes.datatable');
|
// Route::get('nodes/datatable', [NodeController::class, 'datatable'])->name('nodes.datatable');
|
||||||
Route::get('nodes/sync', [NodeController::class, 'sync'])->name('nodes.sync');
|
// Route::get('nodes/sync', [NodeController::class, 'sync'])->name('nodes.sync');
|
||||||
Route::resource('nodes', NodeController::class);
|
// Route::resource('nodes', NodeController::class);
|
||||||
|
//
|
||||||
Route::get('nests/datatable', [NestsController::class, 'datatable'])->name('nests.datatable');
|
// Route::get('nests/datatable', [NestsController::class, 'datatable'])->name('nests.datatable');
|
||||||
Route::get('nests/sync', [NestsController::class, 'sync'])->name('nests.sync');
|
// Route::get('nests/sync', [NestsController::class, 'sync'])->name('nests.sync');
|
||||||
Route::resource('nests', NestsController::class);
|
// Route::resource('nests', NestsController::class);
|
||||||
|
|
||||||
Route::get('configurations/datatable', [ConfigurationController::class, 'datatable'])->name('configurations.datatable');
|
Route::get('configurations/datatable', [ConfigurationController::class, 'datatable'])->name('configurations.datatable');
|
||||||
Route::patch('configurations/updatevalue', [ConfigurationController::class, 'updatevalue'])->name('configurations.updatevalue');
|
Route::patch('configurations/updatevalue', [ConfigurationController::class, 'updatevalue'])->name('configurations.updatevalue');
|
||||||
|
|
2
storage/debugbar/.gitignore
vendored
Normal file
2
storage/debugbar/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*
|
||||||
|
!.gitignore
|
Loading…
Reference in a new issue