I want to make a PHP method using laravel. I want to do the comparison of criteria and criteria. Here is the controller code :
public function create()
{
$kriteria1 = Model\Kriteria::pluck('nama_kriteria', 'id');
$kriteria2 = Model\Kriteria::pluck('nama_kriteria', 'id');
return view('kriteria_kriterias.create')->with('kriteria1', $kriteria1)->with('kriteria2', $kriteria2)->with('data', $data);
}
and this is the blade code :
It will make the form appear as total of criteria#
The problem is, I can't save it all to database. How do I get it to do this?
Updated method in the controller to the following:
How to output in the blade file:
Or you update the controller to pass the complete results:
And the in the blade you can accss the data in various ways, one way is a foreach loop using blade in the blade template:
To accept multiple values dynamicaly in the controller you can try something like this:
Then use the same looping method mentioned above to display them in the blade or a for loop that gets the count and displays accordingly.