I mean,I have
public class MyClass{
public $variable="myValue";
protected $rules = [
'variable' = 'required';
]
public function render()
{
return view('livewire.my-view');
}
public function submit()
{
$db = DB::connection ('myConnection')
$this->validate();
$db = DB::select('INSERT INTO my_table (variable) VALUES (:variable)', ['variable'=>$variable]);
}
But when I execute the script (i have a form and a submit button)
It returns
Error, variable "variable" undefined