vito/app/SSHCommands/Database/LinkCommand.php
2023-08-04 18:28:04 +02:00

32 lines
750 B
PHP
Executable File

<?php
namespace App\SSHCommands\Database;
use App\SSHCommands\Command;
use Illuminate\Support\Facades\File;
class LinkCommand extends Command
{
public function __construct(
protected string $provider,
protected string $username,
protected string $host,
protected string $database
) {
}
public function file(): string
{
return File::get(resource_path(sprintf("commands/database/%s/link.sh", $this->provider)));
}
public function content(): string
{
return str($this->file())
->replace('__username__', $this->username)
->replace('__host__', $this->host)
->replace('__database__', $this->database)
->toString();
}
}