Skip to content

Instantly share code, notes, and snippets.

@cursosdesarrolloweb
Last active July 19, 2021 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cursosdesarrolloweb/1e0765e9813dbd9e70ee22580568ab32 to your computer and use it in GitHub Desktop.
Save cursosdesarrolloweb/1e0765e9813dbd9e70ee22580568ab32 to your computer and use it in GitHub Desktop.
<?php
namespace App\Http\Livewire;
use App\Models\User;
use Illuminate\Support\Collection;
use Livewire\Component;
class Form extends Component
{
public array $users;
public int $user_id;
public int $name = 0;
public function mount() {
$this->users = User::pluck("name", "id")->toArray();
}
public function rules(): array {
return [
'user_id' => 'required|exists:users,id',
'name' => 'required|string|min:2|max:30',
];
}
public function render()
{
return view('livewire.form');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment