Skip to content

Instantly share code, notes, and snippets.

@Sean-Spallen
Created May 10, 2019 08:45
Show Gist options
  • Save Sean-Spallen/8ef9377e6ee9b8bd3a47356afec01e20 to your computer and use it in GitHub Desktop.
Save Sean-Spallen/8ef9377e6ee9b8bd3a47356afec01e20 to your computer and use it in GitHub Desktop.
Laravel - AJAX Store Function
use App\Grocery;
public function store(Request $request)
{
$grocery = new Grocery();
$grocery->name = $request->name;
$grocery->type = $request->type;
$grocery->price = $request->price;
$grocery->save();
return response()->json(['success'=>'Data is successfully added']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment