Kaydet (Commit) ab399330 authored tarafından mertcelen's avatar mertcelen

Server names now unique.

Server add now discovers installed extensions.
üst dcc4f95c
......@@ -9,9 +9,21 @@ use Auth;
class AddController extends Controller
{
/**
* @var \App\Server
*/
public $server;
public function main(){
public function main()
{
// Check if name is already in use.
if(Server::where([
'user_id' => auth()->id(),
"name" => request('name')
])->exists()){
return respond("Bu sunucu ismiyle bir sunucunuz zaten var.",201);
}
// Create object with parameters.
$this->server = new Server(request()->all());
......@@ -77,6 +89,15 @@ class AddController extends Controller
return respond("SSH Hatası",401);
}
foreach(extensions() as $extension){
if($this->server->isRunning($extension->service) == "active\n"){
$extensions_array = $this->server->extensions;
$extensions_array[$extension->_id] = [];
$this->server->extensions = $extensions_array;
$this->server->save();
}
};
return $this->grantPermissions();
}
......
......@@ -125,6 +125,7 @@ function dismissNotification(id) {
checkNotifications();
});
}
let inputs =[];
let modalData = [];
......
......@@ -51,7 +51,7 @@ Artisan::command('import',function(){
});
Artisan::command('export',function(){
$model = \App\Extension::where('_id','5c456c958f2fa510fa60da82')->first();
$model = \App\Extension::where('_id','5c4884c68f2fa558e309f045')->first();
$path = resource_path('views' . DIRECTORY_SEPARATOR .'extensions' . DIRECTORY_SEPARATOR . strtolower($model->name));
$zip = new ZipArchive();
$zip->open('/liman/export/deneme.lmne',ZipArchive::CREATE | ZipArchive::OVERWRITE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment