Added capture photo logic in livewire
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
This commit is contained in:
32
app/Livewire/Webcam.php
Normal file
32
app/Livewire/Webcam.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
class Webcam extends Component
|
||||
{
|
||||
|
||||
public string $capturedPhoto = '';
|
||||
|
||||
// Called from JavaScript when a photo is taken
|
||||
public function setPhoto(string $photo): void
|
||||
{
|
||||
$this->capturedPhoto = $photo;
|
||||
|
||||
// Fires a browser event that the Filament form will listen to
|
||||
$this->dispatch('photo-captured', photo: $photo);
|
||||
}
|
||||
|
||||
// Called from JavaScript when user clicks "Retake"
|
||||
public function clearPhoto(): void
|
||||
{
|
||||
$this->capturedPhoto = '';
|
||||
|
||||
$this->dispatch('photo-captured', photo: '');
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.webcam');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user