i use laravel 8 . and livewire 2.0. without any variable in the blade it working normally but if use any variable it gives Undefined variable: but this variable is declared in class, i try all solutions but the problem not working ca anyone give me an idea
ErrorException
Undefined variable: input(View:C:\xampp\htdocs\sis\resources\views\livewire\admin\grade\addgrade.blade.php)
Hide solutions
$input is undefine
the route Route::view('/add_grades', 'livewire/Admin/Grade/Addgrade')->name('admin.grades.add');.
the blade is
{{$input}}
and the class
<?php
namespace App\Http\Livewire\Admin\Grade;
use Livewire\Component;
use Livewire\Livewire;
use phpDocumentor\Reflection\Types\This;
class Addgrade extends Livewire
{
public $input= 0 ;
public function render()
{
return view('livewire.admin.grade.addgrade');
}
}
Your livewire blade view needs to have a base div:
<div>
{{ $input }}
</div>