Skip to content

Commit

Permalink
Merge branch 'beta'
Browse files Browse the repository at this point in the history
  • Loading branch information
jhowbhz committed Aug 23, 2024
2 parents 37ead57 + 901336e commit 69ff42b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
4 changes: 3 additions & 1 deletion app/Console/Commands/SendMessagesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public function middleware()
public function handle()
{

info('Command runs every minute.');

$disparos = Disparos::where('status', 'pending')
->with('messagesPending')
->get();
Expand Down Expand Up @@ -147,7 +149,7 @@ public function handle()
} catch (\GuzzleHttp\Exception\RequestException $th) {

echo "Erro ao enviar mensagem: " . $th->getMessage() . "\n";
$disparos->status = 'cancelled';
$disparos->status = 'canceled';
$disparos->save();

return;
Expand Down
2 changes: 2 additions & 0 deletions resources/views/admin/disparos.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<th scope="col">Pendentes</th>
<th scope="col">Enviadas</th>
<th scope="col">Modo</th>
<th scope="col">Status</th>
<th scope="col" style="width: 200px">Ações</th>
</tr>
</thead>
Expand Down Expand Up @@ -100,6 +101,7 @@
<option value="">Selecione</option>
<option value="pending">Pendente</option>
<option value="paused">Pausado</option>
<option value="canceled">Cancelado</option>
<option value="finished">Finalizado</option>
</select>
</div>
Expand Down
15 changes: 5 additions & 10 deletions routes/console.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
<?php

use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schedule;

// Artisan::command('inspire', function () {
// $this->comment(Inspiring::quote());
// })->purpose('Display an inspiring quote')->hourly();

//run php artisan app:send-messages-command
// Artisan::command('app:send-messages-command', function () {
// $this->info('Messages sent successfully!');
// })->purpose('Send messages to users')->daily();
//not overlapping with the web routes
Schedule::command('app:send-messages-command')->everyMinute()
// ->appendOutputTo(storage_path('logs/send-messages-command.log'))
->withoutOverlapping();

0 comments on commit 69ff42b

Please sign in to comment.