This commit is contained in:
@@ -12,11 +12,21 @@ class BotsList extends Component
|
||||
{
|
||||
public $bots;
|
||||
|
||||
public string $query = '';
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->bots = Auth::user()->bots;
|
||||
}
|
||||
|
||||
public function search()
|
||||
{
|
||||
$this->bots = Auth::user()->bots()
|
||||
->where('name', 'like', '%' . $this->query . '%')
|
||||
->orWhere('class', 'like', '%' . $this->query . '%')
|
||||
->get();
|
||||
}
|
||||
|
||||
public function toggleBot($botId)
|
||||
{
|
||||
$bot = \App\Models\Bot::find($botId);
|
||||
@@ -62,8 +72,13 @@ class BotsList extends Component
|
||||
|
||||
public function confirmRunBot(Bot $bot): void
|
||||
{
|
||||
$log = $bot->logs()->create([
|
||||
'status' => 'pending',
|
||||
'started_at' => now(),
|
||||
]);
|
||||
|
||||
// Dispatch the job to run the bot
|
||||
dispatch(new RunBot($bot));
|
||||
dispatch(new RunBot($bot, $log));
|
||||
|
||||
flash()->success("Bot '{$bot->name}' is being executed.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user