laravel eloquent select event code example

Example 1: update query in laravel eloquent

$data = DB::table('cart')
                ->where('crt_id', $id)
               ->update(['crt_status' =>'0']);

Example 2: laravel property

// Create a new user in the database...
$user = User::create(array('name' => 'John'));

// Retrieve the user by the attributes, or create it if it doesn't exist...
$user = User::firstOrCreate(array('name' => 'John'));

// Retrieve the user by the attributes, or instantiate a new instance...ddd
$user = User::firstOrNew(array('name' => 'John'));