fixing database connections
This commit is contained in:
@@ -2,15 +2,15 @@
|
||||
|
||||
namespace Lucent\Command;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Lucent\Command\Data\CommandLogItem;
|
||||
use Lucent\Database\Database;
|
||||
|
||||
class CommandRepo
|
||||
{
|
||||
public function findBySignature($signature): ?CommandLogItem
|
||||
{
|
||||
|
||||
$row = DB::table("command_logs")->where("signature", $signature)->first();
|
||||
$row = Database::make()->table("command_logs")->where("signature", $signature)->first();
|
||||
if (empty($row)) {
|
||||
return null;
|
||||
}
|
||||
@@ -22,16 +22,16 @@ class CommandRepo
|
||||
{
|
||||
$foundCommandLogItem = $this->findBySignature($commandLogItem->signature);
|
||||
if (empty($foundCommandLogItem)) {
|
||||
DB::table("command_logs")->insert(toArray($commandLogItem));
|
||||
Database::make()->table("command_logs")->insert(toArray($commandLogItem));
|
||||
return;
|
||||
}
|
||||
|
||||
DB::table("command_logs")->where("signature", $commandLogItem->signature)->update(toArray($commandLogItem));
|
||||
Database::make()->table("command_logs")->where("signature", $commandLogItem->signature)->update(toArray($commandLogItem));
|
||||
}
|
||||
|
||||
public function appendToLogs(string $signature, string $line): void
|
||||
{
|
||||
$res = DB::update(
|
||||
Database::make()->update(
|
||||
'update command_logs set logs = logs || ? where signature = ?',
|
||||
[$line, $signature]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user