I have this code where I needed to store in a variable so I display it in view, I\'ve tried different approach of packing the \"Form header\" and using CSRF is not working
Return the form to another blade like view/products/datatables.blade.php
Example: The controller should looks like:-
public function getproducts()
{
$product = Product::all(); //Product is Model name
return Datatables::of($product)
->addColumn('action', function($product)
{
return view('product.datatables', compact('product'))->render();
})->make(true);
}
And the view should look as below:
Edit
It will work just fine. Because the mustache {{}} can't be read in the controller. We redirect the things to the blade