first commit, after modifying client section

This commit is contained in:
Kwesi Banson
2023-02-22 07:48:50 +00:00
commit ad0dd6a6e1
1880 changed files with 538494 additions and 0 deletions

33
app/Models/ClickServer.php Executable file
View File

@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ClickServer extends Model
{
protected $guarded = array('id');
public $table = "click_servers";
protected $appends = ['root_password'];
public function direct_connections_info(){
return $this->hasMany('App\Models\DirectConnection', 'server_id', 'id');
}
public function credentials_info(){
return $this->hasMany('App\Models\ServerCredential', 'server_id', 'id');
}
public function modified_by_info(){
return $this->hasOne('App\Models\Account', 'id', 'last_modified_by_id');
}
public function getRootPasswordAttribute(){
$credentials = $this->credentials_info;
foreach ($credentials as $value) {
if ($value->username == 'root') {
return $value->password;
}
}
}
}