12.02.2018 Views

laravel_tutorial

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Laravel<br />

Update Records<br />

We can update the records using the DB facade with update method. The syntax of update<br />

method is as shown in the following table.<br />

Syntax<br />

Parameters<br />

Returns<br />

Description<br />

int update(string $query, array $bindings = array())<br />

<br />

<br />

int<br />

$query(string) – query to execute in database<br />

$bindings(array) – values to bind with queries<br />

Run an update statement against the database.<br />

Example<br />

Step 1: Execute the below command to create a controller called StudViewController.<br />

php artisan make:controller StudUpdateController --plain<br />

Step 2: After successful execution, you will receive the following output:<br />

70

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!