How to use Update Statement in Laravel 5

We can update the record using the DB facade with execute an update statement. The number of rows affected by the statement will be returned.

Let’s create an update Statement in laravel 5

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use DB;

class PostController extends Controller
    public function UpdateData()
        DB::update('update post set title = "laravel" where id = ?', ['1']);

Leave a Reply

Your email address will not be published. Required fields are marked *