mardi 29 août 2017

Laravel - Pass a function parameter to a DB method

I have a function that is taking an id as a param, and updates the db using the DB method. however, when i run the code, the variable is not being passed to the method. to test, i replaced $id with an integer and it worked, so i think the DB method can not access the variable from the parameter

public function disable($id)
{

    // Update the user status to 0 from 1
    DB::table('employees')->where('id', $id)->update(['status' => 0]);
    return redirect('/employee')->with('error', 'User is disabled, all related accounts are now shutdown!...');
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire