Illuminate\Database\Connection::commit PHP Method

commit() public method

Commit the active database transaction.
public commit ( ) : void
return void
    public function commit()
    {
        if ($this->transactions == 1) {
            $this->getPdo()->commit();
        }
        $this->transactions = max(0, $this->transactions - 1);
        $this->fireConnectionEvent('committed');
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Save multiple notifications sent
  * at once.
  *
  * @param  array $notifications
  * @return mixed
  */
 public function storeMultiple(array $notifications)
 {
     $this->db->beginTransaction();
     $stackId = $this->db->table($this->notification->getTable())->max('stack_id') + 1;
     foreach ($notifications as $key => $notification) {
         $notifications[$key]['stack_id'] = $stackId;
     }
     $insert = $this->db->table($this->notification->getTable())->insert($notifications);
     $this->db->commit();
     return $insert;
 }
All Usage Examples Of Illuminate\Database\Connection::commit