Compare values?

0

I will try to be brief, I do not know if something like this is possible, I want to edit the values of a table, which is what is done with an update, but I want to allow editing those values compare the values that are stored, with the new ones, and if equal store them, otherwise do not allow to do it. I explain the reason; I'm going to store data from a transaction, but the administrator must authorize that transaction, but in order to authorize it should be able to enter the transaction number, and if it is the same then it is stored and authorization is allowed, if it is different then it is denied.

    
asked by JoséOrdoñez 05.12.2017 в 00:54
source

1 answer

0

Nose if I understood correctly, but what you could do is look for the transaction based on the digits that the user enters, in case there is that transaction you update it, using eloquent would be something like that ..

// Id es el id de transacción que ingreso el usuario, en caso de no querer buscar por id podes usar el metodo find..
$data = App\SomeModel::findOrFail($id);


// Si usas el metodo findOrFail ya te aseguras de que la transaccion existe, pero de todas formas poder usar un if

if (data)
{
   // actualizas los datos..
}
    
answered by 05.12.2017 в 01:05