The blade not calling a function in the component
I have a modal within a blade view (criteria.blade.php) and I want this modal when triggered and filled to call the function with a component (Criteria.php) which sends data to the database.
However, the function saveCriteria() is not being called and unfortunately the database is not being populated with the new data.
criterias.blade.php
Criterias.php
namespace App\Livewire\Admin;
use Livewire\Component; use App\Models\AssessmentCategory;
class Criterias extends Component
{
public $criterias;
public function render()
{
return view('livewire.admin.criterias');
}
public function mount()
{
$this->criterias=AssessmentCategory::all();
}
public $criteria;
public $marks;
public function saveCriteria()
{
$validated=$this->validate([
'criteria'=>'required|max:255',
'marks'=>'required|max:2',
]);
AssessmentCategory::create($validated);
$this->reset();
}
}