Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

And here's the error message: Whoops, looks like something went wrong.

2/2 QueryException in Connection.php line 761: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'image_id' cannot be null (SQL: insert into image_tag (created_at, image_id, tag_id, updated_at) values (2016-10-04 18:35:45, , 2, 2016-10-04 18:35:45), (2016-10-04 18:35:45, , 8, 2016-10-04 18:35:45), (2016-10-04 18:35:45, , 10, 2016-10-04 18:35:45)) in Connection.php line 761 at Connection->runQueryCallback('insert into image_tag (created_at, image_id, tag_id, updated_at) values (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?)', array(object(Carbon), null, '2', object(Carbon), object(Carbon), null, '8', object(Carbon), object(Carbon), null, '10', object(Carbon)), object(Closure)) in Connection.php line 717 at Connection->run('insert into image_tag (created_at, image_id, tag_id, updated_at) values (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?)', array(object(Carbon), null, '2', object(Carbon), object(Carbon), null, '8', object(Carbon), object(Carbon), null, '10', object(Carbon)), object(Closure)) in Connection.php line 481 at Connection->statement('insert into image_tag (created_at, image_id, tag_id, updated_at) values (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?)', array(object(Carbon), null, '2', object(Carbon), object(Carbon), null, '8', object(Carbon), object(Carbon), null, '10', object(Carbon))) in Connection.php line 435 at Connection->insert('insert into image_tag (created_at, image_id, tag_id, updated_at) values (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?)', array(object(Carbon), null, '2', object(Carbon), object(Carbon), null, '8', object(Carbon), object(Carbon), null, '10', object(Carbon))) in Builder.php line 2126 at Builder->insert(array(array('image_id' => null, 'tag_id' => '2', 'created_at' => object(Carbon), 'updated_at' => object(Carbon)), array('image_id' => null, 'tag_id' => '8', 'created_at' => object(Carbon), 'updated_at' => object(Carbon)), array('image_id' => null, 'tag_id' => '10', 'created_at' => object(Carbon), 'updated_at' => object(Carbon)))) in BelongsToMany.php line 1031 at BelongsToMany->attach(array('2', '8', '10')) in PhotographyController.php line 77 at PhotographyController->store(object(Request)) at call_user_func_array(array(object(PhotographyController), 'store'), array(object(Request))) in Controller.php line 55 at Controller->callAction('store', array(object(Request))) in ControllerDispatcher.php line 44 at ControllerDispatcher->dispatch(object(Route), object(PhotographyController), 'store') in Route.php line 190 at Route->runController() in Route.php line 144 at Route->run(object(Request)) in Router.php line 642 at Router->Illuminate\Routing{closure}(object(Request)) in Pipeline.php line 53 at Pipeline->Illuminate\Routing{closure}(object(Request)) in SubstituteBindings.php line 41 at SubstituteBindings->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing{closure}(object(Request)) in Authenticate.php line 43 at Authenticate->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing{closure}(object(Request)) in VerifyCsrfToken.php line 65 at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing{closure}(object(Request)) in ShareErrorsFromSession.php line 49 at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing{closure}(object(Request)) in StartSession.php line 64 at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37 at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing{closure}(object(Request)) in EncryptCookies.php line 59 at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing{closure}(object(Request)) in Pipeline.php line 104 at Pipeline->then(object(Closure)) in Router.php line 644 at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 618 at Router->dispatchToRoute(object(Request)) in Router.php line 596 at Router->dispatch(object(Request)) in Kernel.php line 267 at Kernel->Illuminate\Foundation\Http{closure}(object(Request)) in Pipeline.php line 53 at Pipeline->Illuminate\Routing{closure}(object(Request)) in CheckForMaintenanceMode.php line 46 at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing{closure}(object(Request)) in Pipeline.php line 104 at Pipeline->then(object(Closure)) in Kernel.php line 149 at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116 at Kernel->handle(object(Request)) in index.php line 54 1/2 PDOException in Connection.php line 480: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'image_id' cannot be null in Connection.php line 480 at PDOStatement->execute() in Connection.php line 480 at Connection->Illuminate\Database{closure}(object(MySqlConnection), 'insert into image_tag (created_at, image_id, tag_id, updated_at) values (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?)', array(object(Carbon), null, '2', object(Carbon), object(Carbon), null, '8', object(Carbon), object(Carbon), null, '10', object(Carbon))) in Connection.php line 754 at Connection->runQueryCallback('insert into image_tag (created_at, image_id, tag_id, updated_at) values (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?)', array(object(Carbon), null, '2', object(Carbon), object(Carbon), null, '8', object(Carbon), object(Carbon), null, '10', object(Carbon)), object(Closure)) in Connection.php line 717 at Connection->run('insert into image_tag (created_at, image_id, tag_id, updated_at) values (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?)', array(object(Carbon), null, '2', object(Carbon), object(Carbon), null, '8', object(Carbon), object(Carbon), null, '10', object(Carbon)), object(Closure)) in Connection.php line 481 at Connection->statement('insert into image_tag (created_at, image_id, tag_id, updated_at) values (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?)', array(object(Carbon), null, '2', object(Carbon), object(Carbon), null, '8', object(Carbon), object(Carbon), null, '10', object(Carbon))) in Connection.php line 435 at Connection->insert('insert into image_tag (created_at, image_id, tag_id, updated_at) values (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?)', array(object(Carbon), null, '2', object(Carbon), object(Carbon), null, '8', object(Carbon), object(Carbon), null, '10', object(Carbon))) in Builder.php line 2126 at Builder->insert(array(array('image_id' => null, 'tag_id' => '2', 'created_at' => object(Carbon), 'updated_at' => object(Carbon)), array('image_id' => null, 'tag_id' => '8', 'created_at' => object(Carbon), 'updated_at' => object(Carbon)), array('image_id' => null, 'tag_id' => '10', 'created_at' => object(Carbon), 'updated_at' => object(Carbon)))) in BelongsToMany.php line 1031 at BelongsToMany->attach(array('2', '8', '10')) in PhotographyController.php line 77 at PhotographyController->store(object(Request)) at call_user_func_array(array(object(PhotographyController), 'store'), array(object(Request))) in Controller.php line 55 at Controller->callAction('store', array(object(Request))) in ControllerDispatcher.php line 44 at ControllerDispatcher->dispatch(object(Route), object(PhotographyController), 'store') in Route.php line 190 at Route->runController() in Route.php line 144 at Route->run(object(Request)) in Router.php line 642 at Router->Illuminate\Routing{closure}(object(Request)) in Pipeline.php line 53 at Pipeline->Illuminate\Routing{closure}(object(Request)) in SubstituteBindings.php line 41 at SubstituteBindings->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing{closure}(object(Request)) in Authenticate.php line 43 at Authenticate->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing{closure}(object(Request)) in VerifyCsrfToken.php line 65 at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing{closure}(object(Request)) in ShareErrorsFromSession.php line 49 at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing{closure}(object(Request)) in StartSession.php line 64 at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37 at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing{closure}(object(Request)) in EncryptCookies.php line 59 at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing{closure}(object(Request)) in Pipeline.php line 104 at Pipeline->then(object(Closure)) in Router.php line 644 at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 618 at Router->dispatchToRoute(object(Request)) in Router.php line 596 at Router->dispatch(object(Request)) in Kernel.php line 267 at Kernel->Illuminate\Foundation\Http{closure}(object(Request)) in Pipeline.php line 53 at Pipeline->Illuminate\Routing{closure}(object(Request)) in CheckForMaintenanceMode.php line 46 at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing{closure}(object(Request)) in Pipeline.php line 104 at Pipeline->then(object(Closure)) in Kernel.php line 149 at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116 at Kernel->handle(object(Request)) in index.php line 54

0

Dilaz pointed out on livechat that image doesn't have an id before being saved. Obvious really.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

rabbitdan rabbitdan Joined 4 Oct 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.