mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
nostr events added
This commit is contained in:
27
app/Traits/NostrTrait.php
Normal file
27
app/Traits/NostrTrait.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use Illuminate\Support\Facades\Process;
|
||||
|
||||
trait NostrTrait
|
||||
{
|
||||
public function publishOnNostr($model, $text): array
|
||||
{
|
||||
//noscl publish "Good morning!"
|
||||
$result = Process::timeout(60 * 5)
|
||||
->run('noscl publish "'.$text.'"');
|
||||
|
||||
if ($result->successful()) {
|
||||
$model->nostr_status = $result->output();
|
||||
$model->save();
|
||||
}
|
||||
|
||||
return [
|
||||
'success' => $result->successful(),
|
||||
'output' => $result->output(),
|
||||
'exitCode' => $result->exitCode(),
|
||||
'errorOutput' => $result->errorOutput()
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user