mardi 1 novembre 2016

insert data in database laravel

First i got last value of "balance" column from the table. Then for new row. i entered new value for "credit" and saved. Then i added new credit value and old balance value. Now i have to insert that added data in the new balance. I don't know how to do it. i m using la ravel latest version only.help me.

 `public function store(Request $request)
{
    $get_bal= Sbi::all() -> last()['balance'];


    $credit_inp=new Sbi;
    $credit_inp->credit=Input::get("credit");
    $credit_inp->save();


    $get_inp= Sbi::all() -> last()['credit'];


    $new_bal=$get_bal+$get_inp;

    echo "Current balance is :" .$new_bal;
}`



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire