25 lines
551 B
PHP
25 lines
551 B
PHP
<?php
|
|
|
|
namespace App\Livewire\Automations;
|
|
|
|
use App\Models\Automation;
|
|
use Livewire\Attributes\Layout;
|
|
use Livewire\Component;
|
|
|
|
#[Layout('layouts.app')]
|
|
class Index extends Component
|
|
{
|
|
public function toggle(string $uuid): void
|
|
{
|
|
$automation = Automation::where('uuid', $uuid)->first();
|
|
$automation?->update(['enabled' => ! $automation->enabled]);
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.automations.index', [
|
|
'automations' => Automation::orderBy('name')->get(),
|
|
]);
|
|
}
|
|
}
|