mardi 1 novembre 2016

update and delete record in laravel

I'm learning so I'm a beginner in laravel. I finally wrote my function that adds a record in mySQL database. Now I tried to update and delete based on this function but construct a correct one. public function add(Request $resquest) {

    if ($resquest->isMethod('post')) {

        $newmaid = New Product();
        $newmaid->name = $resquest->input('name');
        $newmaid->price = $resquest->input('price');
        $newmaid->save();

    }
    return view('add');

}

the function I wrote will show a form when click on submit it adds record to database and returns to same page.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire