This commit is contained in:
HolgerHatGarKeineNode
2023-04-25 23:09:21 +02:00
parent 5a4322b035
commit ed54b25567
32 changed files with 683 additions and 12 deletions

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Traits;
use App\CodeIsSpeech;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Route;
trait HasTextToSpeech
{
use CodeIsSpeech;
public function mountHasTextToSpeech()
{
$id = str(Route::currentRouteName())
->replace('.', ' ')
->camel()
->toString();
$text = $this->$id();
File::put(storage_path('app/public/tts/'.$id.'.txt'), $text);
if (
in_array($id, [
//'authLn',
'profileLnbits',
'meetupWorld',
'bitcoinEventTableBitcoinEvent',
'libraryTableLibraryItems',
'schoolTableCourse',
])
&& File::exists(storage_path('app/public/tts/'.$id.'.wav'))
) {
dispatch(new \App\Jobs\CodeIsSpeech($id, false))->delay(now()->addSecond());
} elseif (in_array($id, ['welcome']) && auth()->check()) {
} else {
dispatch(new \App\Jobs\CodeIsSpeech($id))->delay(now()->addSecond());
}
}
}