hello, I need help, I am new to Laravel and I would like to know how to modify a single attribute of a logging [closed]

-1
//Esto son los atributos, practicamente quiero tratar de utilizar esta forma
//solicitudes::find($id);    

public function up()
        {
            Schema::create('solicitudes', function (Blueprint $table) {
                $table->increments('id')->unique();
                $table->string('titulo',10);
                $table->string('mensaje',1000);
                $table->boolean('estado')->default(false);
                $table->timestamps();
            });
        }
    
asked by DeathInWhite 31.01.2018 в 19:49
source

1 answer

0

To modify an attribute of a table, you must do the following:

Find the record you want to modify:

$miSolicitud = Solicitudes::find($id);

Then, you modify the attributes in the following way:

$miSolicitud->atributoUno = "Valor de atributo"

Changing "oneAttribute" by the name of the column you want to modify.

Finally, to save you write:

$miSolicitud->save();

The above must be done (usually) in the Controller classes (App \ Controllers). The code you put in the question is a migration, which is used to create tables in the database. Check what are the verbs or HTTP methods and the documentation of drivers in Laravel so you can properly handle the methods used for transactions of databases.

    
answered by 31.01.2018 / 22:23
source