Javier Feliz b5ff255063
Some checks failed
tests / ci (push) Has been cancelled
linter / quality (push) Has been cancelled
Build & Push Docker Image to Registry / build (release) Successful in 4m21s
Update action with correct name
2025-07-22 22:24:21 -04:00

34 lines
734 B
PHP

<?php
namespace App\Livewire\Forms;
use Livewire\Attributes\Validate;
use Livewire\Component;
class Script extends Component
{
#[Validate('required')]
public string $name = '';
#[Validate('required')]
public string $path = '';
#[Validate('required')]
public string $content = '';
public function create()
{
$this->validate();
auth()->user()->scripts()->create([
'name' => $this->name,
'path' => str($this->path)->remove('.sh')->lower()->kebab()->toString(),
'content' => $this->content
]);
$this->reset(['name', 'path', 'content']);
}
public function render()
{
return view('livewire.forms.script');
}
}