๐งช Testing Batch Sync API ========================= Setup: Creating test scanner device... โ Scanner created โ JWT token generated Setup: Finding test event... โ Using event: (ID: 1) Setup: Creating test tickets...
Illuminate\Database\QueryException {#2047 +errorInfo: array:3 [ 0 => "23000" 1 => 1062 2 => "Duplicate entry '' for key 'tickets_booking_id_unique'" ] #sql: "insert into `tickets` (`event_id`, `updated_at`, `created_at`) values (?, ?, ?)" #bindings: array:3 [ 0 => 1 1 => "2026-02-03 07:40:09" 2 => "2026-02-03 07:40:09" ] }
// If an exception occurs when attempting to run a query, we'll format the error // message to include the bindings with SQL, which will make this exception a // lot more helpful to the developer instead of just the database's errors. catch (Exception $e) { throw new QueryException( $query, $this->prepareBindings($bindings), $e ); } } // Here we will run this query. If an exception occurs we'll determine if it was // caused by a connection that has been lost. If that is the cause, we'll try // to re-establish connection and re-run the query with a fresh connection. try { $result = $this->runQueryCallback($query, $bindings, $callback); } catch (QueryException $e) { $result = $this->handleQueryException( $e, $query, $bindings, $callback ); } * @param array $bindings * @return bool */ public function statement($query, $bindings = []) { return $this->run($query, $bindings, function ($query, $bindings) { if ($this->pretending()) { return true; } $statement = $this->getPdo()->prepare($query); * @param array $bindings * @return bool */ public function insert($query, $bindings = []) { return $this->statement($query, $bindings); } /** * Run an update statement against the database. * * @param string|null $sequence * @return int */ public function processInsertGetId(Builder $query, $sql, $values, $sequence = null) { $query->getConnection()->insert($sql, $values); $id = $query->getConnection()->getPdo()->lastInsertId($sequence); return is_numeric($id) ? (int) $id : $id; } $sql = $this->grammar->compileInsertGetId($this, $values, $sequence); $values = $this->cleanBindings($values); return $this->processor->processInsertGetId($this, $sql, $values, $sequence); } /** * Insert new records into the table using a subquery. * if ($this->hasNamedScope($method)) { return $this->callNamedScope($method, $parameters); } if (in_array($method, $this->passthru)) { return $this->toBase()->{$method}(...$parameters); } $this->forwardCallTo($this->query, $method, $parameters); return $this; * @param array $attributes * @return void */ protected function insertAndSetId(Builder $query, $attributes) { $id = $query->insertGetId($attributes, $keyName = $this->getKeyName()); $this->setAttribute($keyName, $id); } /** // the query builder, which will give us back the final inserted ID for this // table from the database. Not all tables have to be incrementing though. $attributes = $this->getAttributesForInsert(); if ($this->getIncrementing()) { $this->insertAndSetId($query, $attributes); } // If the table isn't incrementing we'll simply insert these attributes as they // are. These attribute arrays must contain an "id" column previously placed // there by the developer as the manually determined key for these models. // If the model is brand new, we'll insert it into our database and set the // ID attribute on the model to the value of the newly inserted row's ID // which is typically an auto-increment value managed by the database. else { $saved = $this->performInsert($query); if (! $this->getConnectionName() && $connection = $query->getConnection()) { $this->setConnection($connection->getName()); } * @return \Illuminate\Database\Eloquent\Model|$this */ public function create(array $attributes = []) { return tap($this->newModelInstance($attributes), function ($instance) { $instance->save(); }); } /** * Save a new model and return the instance. Allow mass-assignment. { if (is_null($callback)) { return new HigherOrderTapProxy($value); } $callback($value); return $value; }} * @param array $attributes * @return \Illuminate\Database\Eloquent\Model|$this */ public function create(array $attributes = []) { return tap($this->newModelInstance($attributes), function ($instance) { $instance->save(); }); } /** * @throws \BadMethodCallException */ protected function forwardCallTo($object, $method, $parameters) { try { return $object->{$method}(...$parameters); } catch (Error|BadMethodCallException $e) { $pattern = '~^Call to undefined method (?P<class>[^:]+)::(?P<method>[^\(]+)\(\)$~'; if (! preg_match($pattern, $e->getMessage(), $matches)) { throw $e; if (Str::startsWith($method, 'through') && method_exists($this, $relationMethod = Str::of($method)->after('through')->lcfirst()->toString())) { return $this->through($relationMethod); } return $this->forwardCallTo($this->newQuery(), $method, $parameters); } /** * Handle dynamic static method calls into the model. * * @param array $parameters * @return mixed */ public static function __callStatic($method, $parameters) { return (new static)->$method(...$parameters); } /** * Convert the model to its string representation. *// Setup: Create test ticketsecho "Setup: Creating test tickets...\n";$tickets = [];for ($i = 1; $i <= 5; $i++) { $tickets[] = Ticket::create([ 'event_id' => $event->id, 'verification_code' => 'TEST' . Str::random(17), 'ticket_number' => 'BATCH-TEST-' . $i, 'seat_number' => "A{$i}", 'order_id' => 1, $this->bindValues($statement, $this->prepareBindings($bindings)); $this->recordsHaveBeenModified(); return $statement->execute(); }); } /** * Run an SQL statement and get the number of rows affected. $this->bindValues($statement, $this->prepareBindings($bindings)); $this->recordsHaveBeenModified(); return $statement->execute(); }); } /** * Run an SQL statement and get the number of rows affected. { // To execute the statement, we'll simply call the callback, which will actually // run the SQL against the PDO connection. Then we can calculate the time it // took to execute and log the query SQL, bindings and time in our memory. try { return $callback($query, $bindings); } // If an exception occurs when attempting to run a query, we'll format the error // message to include the bindings with SQL, which will make this exception a // lot more helpful to the developer instead of just the database's errors. // Here we will run this query. If an exception occurs we'll determine if it was // caused by a connection that has been lost. If that is the cause, we'll try // to re-establish connection and re-run the query with a fresh connection. try { $result = $this->runQueryCallback($query, $bindings, $callback); } catch (QueryException $e) { $result = $this->handleQueryException( $e, $query, $bindings, $callback ); } * @param array $bindings * @return bool */ public function statement($query, $bindings = []) { return $this->run($query, $bindings, function ($query, $bindings) { if ($this->pretending()) { return true; } $statement = $this->getPdo()->prepare($query); * @param array $bindings * @return bool */ public function insert($query, $bindings = []) { return $this->statement($query, $bindings); } /** * Run an update statement against the database. * * @param string|null $sequence * @return int */ public function processInsertGetId(Builder $query, $sql, $values, $sequence = null) { $query->getConnection()->insert($sql, $values); $id = $query->getConnection()->getPdo()->lastInsertId($sequence); return is_numeric($id) ? (int) $id : $id; } $sql = $this->grammar->compileInsertGetId($this, $values, $sequence); $values = $this->cleanBindings($values); return $this->processor->processInsertGetId($this, $sql, $values, $sequence); } /** * Insert new records into the table using a subquery. * if ($this->hasNamedScope($method)) { return $this->callNamedScope($method, $parameters); } if (in_array($method, $this->passthru)) { return $this->toBase()->{$method}(...$parameters); } $this->forwardCallTo($this->query, $method, $parameters); return $this; * @param array $attributes * @return void */ protected function insertAndSetId(Builder $query, $attributes) { $id = $query->insertGetId($attributes, $keyName = $this->getKeyName()); $this->setAttribute($keyName, $id); } /** // the query builder, which will give us back the final inserted ID for this // table from the database. Not all tables have to be incrementing though. $attributes = $this->getAttributesForInsert(); if ($this->getIncrementing()) { $this->insertAndSetId($query, $attributes); } // If the table isn't incrementing we'll simply insert these attributes as they // are. These attribute arrays must contain an "id" column previously placed // there by the developer as the manually determined key for these models. // If the model is brand new, we'll insert it into our database and set the // ID attribute on the model to the value of the newly inserted row's ID // which is typically an auto-increment value managed by the database. else { $saved = $this->performInsert($query); if (! $this->getConnectionName() && $connection = $query->getConnection()) { $this->setConnection($connection->getName()); } * @return \Illuminate\Database\Eloquent\Model|$this */ public function create(array $attributes = []) { return tap($this->newModelInstance($attributes), function ($instance) { $instance->save(); }); } /** * Save a new model and return the instance. Allow mass-assignment. { if (is_null($callback)) { return new HigherOrderTapProxy($value); } $callback($value); return $value; }} * @param array $attributes * @return \Illuminate\Database\Eloquent\Model|$this */ public function create(array $attributes = []) { return tap($this->newModelInstance($attributes), function ($instance) { $instance->save(); }); } /** * @throws \BadMethodCallException */ protected function forwardCallTo($object, $method, $parameters) { try { return $object->{$method}(...$parameters); } catch (Error|BadMethodCallException $e) { $pattern = '~^Call to undefined method (?P<class>[^:]+)::(?P<method>[^\(]+)\(\)$~'; if (! preg_match($pattern, $e->getMessage(), $matches)) { throw $e; if (Str::startsWith($method, 'through') && method_exists($this, $relationMethod = Str::of($method)->after('through')->lcfirst()->toString())) { return $this->through($relationMethod); } return $this->forwardCallTo($this->newQuery(), $method, $parameters); } /** * Handle dynamic static method calls into the model. * * @param array $parameters * @return mixed */ public static function __callStatic($method, $parameters) { return (new static)->$method(...$parameters); } /** * Convert the model to its string representation. *// Setup: Create test ticketsecho "Setup: Creating test tickets...\n";$tickets = [];for ($i = 1; $i <= 5; $i++) { $tickets[] = Ticket::create([ 'event_id' => $event->id, 'verification_code' => 'TEST' . Str::random(17), 'ticket_number' => 'BATCH-TEST-' . $i, 'seat_number' => "A{$i}", 'order_id' => 1,|
[2/2]
QueryException
|
|---|
Illuminate\Database\QueryException:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'tickets_booking_id_unique' (SQL: insert into `tickets` (`event_id`, `updated_at`, `created_at`) values (1, 2026-02-03 07:40:09, 2026-02-03 07:40:09))
at /home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760
at Illuminate\Database\Connection->runQueryCallback('insert into `tickets` (`event_id`, `updated_at`, `created_at`) values (?, ?, ?)', array(1, '2026-02-03 07:40:09', '2026-02-03 07:40:09'), object(Closure))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Connection.php:720)
at Illuminate\Database\Connection->run('insert into `tickets` (`event_id`, `updated_at`, `created_at`) values (?, ?, ?)', array(1, '2026-02-03 07:40:09', '2026-02-03 07:40:09'), object(Closure))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Connection.php:534)
at Illuminate\Database\Connection->statement('insert into `tickets` (`event_id`, `updated_at`, `created_at`) values (?, ?, ?)', array(1, '2026-02-03 07:40:09', '2026-02-03 07:40:09'))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Connection.php:498)
at Illuminate\Database\Connection->insert('insert into `tickets` (`event_id`, `updated_at`, `created_at`) values (?, ?, ?)', array(1, '2026-02-03 07:40:09', '2026-02-03 07:40:09'))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php:32)
at Illuminate\Database\Query\Processors\Processor->processInsertGetId(object(Builder), 'insert into `tickets` (`event_id`, `updated_at`, `created_at`) values (?, ?, ?)', array(1, '2026-02-03 07:40:09', '2026-02-03 07:40:09'), 'id')
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:3322)
at Illuminate\Database\Query\Builder->insertGetId(array(1, '2026-02-03 07:40:09', '2026-02-03 07:40:09'), 'id')
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:1869)
at Illuminate\Database\Eloquent\Builder->__call('insertGetId', array(array('event_id' => 1, 'updated_at' => '2026-02-03 07:40:09', 'created_at' => '2026-02-03 07:40:09'), 'id'))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1330)
at Illuminate\Database\Eloquent\Model->insertAndSetId(object(Builder), array('event_id' => 1, 'updated_at' => '2026-02-03 07:40:09', 'created_at' => '2026-02-03 07:40:09'))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1295)
at Illuminate\Database\Eloquent\Model->performInsert(object(Builder))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1138)
at Illuminate\Database\Eloquent\Model->save()
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:986)
at Illuminate\Database\Eloquent\Builder->Illuminate\Database\Eloquent\{closure}(object(Ticket))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Support/helpers.php:319)
at tap(object(Ticket), object(Closure))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:985)
at Illuminate\Database\Eloquent\Builder->create(array('event_id' => 1, 'verification_code' => 'TESTHK3uxmjuwMqYdS0zC', 'ticket_number' => 'BATCH-TEST-1', 'seat_number' => 'A1', 'order_id' => 1, 'is_revoked' => false))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:23)
at Illuminate\Database\Eloquent\Model->forwardCallTo(object(Builder), 'create', array(array('event_id' => 1, 'verification_code' => 'TESTHK3uxmjuwMqYdS0zC', 'ticket_number' => 'BATCH-TEST-1', 'seat_number' => 'A1', 'order_id' => 1, 'is_revoked' => false)))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:2330)
at Illuminate\Database\Eloquent\Model->__call('create', array(array('event_id' => 1, 'verification_code' => 'TESTHK3uxmjuwMqYdS0zC', 'ticket_number' => 'BATCH-TEST-1', 'seat_number' => 'A1', 'order_id' => 1, 'is_revoked' => false)))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:2342)
at Illuminate\Database\Eloquent\Model::__callStatic('create', array(array('event_id' => 1, 'verification_code' => 'TESTHK3uxmjuwMqYdS0zC', 'ticket_number' => 'BATCH-TEST-1', 'seat_number' => 'A1', 'order_id' => 1, 'is_revoked' => false)))
(/home/globalgala/public_html/2026_backend_dev/tests/manual/test-batch-sync-api.php:60)
|
|
[1/2]
PDOException
|
|---|
PDOException:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'tickets_booking_id_unique'
at /home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Connection.php:545
at PDOStatement->execute()
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Connection.php:545)
at Illuminate\Database\Connection->Illuminate\Database\{closure}('insert into `tickets` (`event_id`, `updated_at`, `created_at`) values (?, ?, ?)', array(1, '2026-02-03 07:40:09', '2026-02-03 07:40:09'))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Connection.php:753)
at Illuminate\Database\Connection->runQueryCallback('insert into `tickets` (`event_id`, `updated_at`, `created_at`) values (?, ?, ?)', array(1, '2026-02-03 07:40:09', '2026-02-03 07:40:09'), object(Closure))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Connection.php:720)
at Illuminate\Database\Connection->run('insert into `tickets` (`event_id`, `updated_at`, `created_at`) values (?, ?, ?)', array(1, '2026-02-03 07:40:09', '2026-02-03 07:40:09'), object(Closure))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Connection.php:534)
at Illuminate\Database\Connection->statement('insert into `tickets` (`event_id`, `updated_at`, `created_at`) values (?, ?, ?)', array(1, '2026-02-03 07:40:09', '2026-02-03 07:40:09'))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Connection.php:498)
at Illuminate\Database\Connection->insert('insert into `tickets` (`event_id`, `updated_at`, `created_at`) values (?, ?, ?)', array(1, '2026-02-03 07:40:09', '2026-02-03 07:40:09'))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php:32)
at Illuminate\Database\Query\Processors\Processor->processInsertGetId(object(Builder), 'insert into `tickets` (`event_id`, `updated_at`, `created_at`) values (?, ?, ?)', array(1, '2026-02-03 07:40:09', '2026-02-03 07:40:09'), 'id')
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:3322)
at Illuminate\Database\Query\Builder->insertGetId(array(1, '2026-02-03 07:40:09', '2026-02-03 07:40:09'), 'id')
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:1869)
at Illuminate\Database\Eloquent\Builder->__call('insertGetId', array(array('event_id' => 1, 'updated_at' => '2026-02-03 07:40:09', 'created_at' => '2026-02-03 07:40:09'), 'id'))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1330)
at Illuminate\Database\Eloquent\Model->insertAndSetId(object(Builder), array('event_id' => 1, 'updated_at' => '2026-02-03 07:40:09', 'created_at' => '2026-02-03 07:40:09'))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1295)
at Illuminate\Database\Eloquent\Model->performInsert(object(Builder))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1138)
at Illuminate\Database\Eloquent\Model->save()
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:986)
at Illuminate\Database\Eloquent\Builder->Illuminate\Database\Eloquent\{closure}(object(Ticket))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Support/helpers.php:319)
at tap(object(Ticket), object(Closure))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:985)
at Illuminate\Database\Eloquent\Builder->create(array('event_id' => 1, 'verification_code' => 'TESTHK3uxmjuwMqYdS0zC', 'ticket_number' => 'BATCH-TEST-1', 'seat_number' => 'A1', 'order_id' => 1, 'is_revoked' => false))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:23)
at Illuminate\Database\Eloquent\Model->forwardCallTo(object(Builder), 'create', array(array('event_id' => 1, 'verification_code' => 'TESTHK3uxmjuwMqYdS0zC', 'ticket_number' => 'BATCH-TEST-1', 'seat_number' => 'A1', 'order_id' => 1, 'is_revoked' => false)))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:2330)
at Illuminate\Database\Eloquent\Model->__call('create', array(array('event_id' => 1, 'verification_code' => 'TESTHK3uxmjuwMqYdS0zC', 'ticket_number' => 'BATCH-TEST-1', 'seat_number' => 'A1', 'order_id' => 1, 'is_revoked' => false)))
(/home/globalgala/public_html/2026_backend_dev/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:2342)
at Illuminate\Database\Eloquent\Model::__callStatic('create', array(array('event_id' => 1, 'verification_code' => 'TESTHK3uxmjuwMqYdS0zC', 'ticket_number' => 'BATCH-TEST-1', 'seat_number' => 'A1', 'order_id' => 1, 'is_revoked' => false)))
(/home/globalgala/public_html/2026_backend_dev/tests/manual/test-batch-sync-api.php:60)
|