Files
ERP-upgrade/app/Models/ClickServer.php
2026-09-23 09:03:01 +00:00

36 lines
936 B
PHP
Executable File

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Traits\LogsActivity;
class ClickServer extends Model
{
use LogsActivity;
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\SystemUser', 'id', 'last_modified_by_id');
}
public function getRootPasswordAttribute(){
$credentials = $this->credentials_info;
foreach ($credentials as $value) {
if ($value->username == 'root') {
return $value->password;
}
}
}
}