YouTube Icon

Code Playground.

How to use Update Statement in Laravel 5

CFG

How to use Update Statement in Laravel 5

Using the DB framework, we can change the record with an update argument. It will return the number of rows affected by the argument.

Let's build an update 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']);
    }
}




CFG