Created
May 10, 2019 08:45
-
-
Save Sean-Spallen/8ef9377e6ee9b8bd3a47356afec01e20 to your computer and use it in GitHub Desktop.
Laravel - AJAX Store Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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