This repository has been archived on 2024-05-20. You can view files and clone it, but cannot push or open issues or pull requests.
2023-10-08 02:13:03 -04:00

36 lines
1.1 KiB
PHP

<?php
use Illuminate\Support\Facades\Http;
use Livewire\Attributes\Layout;
use Livewire\Attributes\Rule;
use Livewire\Volt\Component;
new #[Layout('layouts.app')] class extends Component
{
#[Rule(['required', 'string'])]
public string $quote = '';
public function sendQuote(): void
{
$validated = $this->validate();
$data = ["text" => $validated['quote']];
$response = Http::post(env('SLACK_WEBHOOK_URL'), $data);
$this->quote = '';
}
}; ?>
<div class="px-4 sm:px-6 lg:px-8">
<form wire:submit="sendQuote">
<x-text-input
wire:model="quote"
placeholder="{{ __('What did he say this time?') }}"
class="block w-full border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm"
></x-text-input>
<x-input-error :messages="$errors->get('quote')" class="mt-2"/>
<x-primary-button wire:loading.attr="disabled" wire:loading.class="opacity-50" class="mt-4">{{ __('Request') }}</x-primary-button>
</form>
</div>