laravel update database record code example

Example 1: laravel delete where

DB::table('users')->where('id', $id)->delete();

Example 2: laravel db::query update

DB::table('user')->where('email', $userEmail)->update(array('member_type' => $plan));

Example 3: update query laravel

$update = \DB::table('student') ->where('id', $data['id']) ->limit(1) ->update( [ 'name' => $data['name'], 'address' => $data['address'], 'email' => $data['email'], 'contactno' => $data['contactno'] ]);

Example 4: laravel find query

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Flight extends Model
{
    /**
     * Indicates if the model should be timestamped.
     *
     * @var bool
     */
    public $timestamps = false;
}

Tags:

Sql Example