Support the ongoing development of Laravel.io →
Requests Input Forms
Last updated 2 years ago.
0

The stack trace in your laravel.log (found in app/storage/log/) should help you find the origin of the error. If not, post the last stack trace (not the whole log file) here. Maybe we can help.

Last updated 9 years ago.
0

I am new in Laravel so I will put it here:

[2014-12-07 17:02:53] production.ERROR: exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'author' cannot be null' in /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php:344
Stack trace:
#0 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php(344): PDOStatement->execute(Array)
#1 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php(592): Illuminate\Database\Connection->Illuminate\Database\{closure}(Object(Illuminate\Database\MySqlConnection), 'insert into `bl...', Array)
#2 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php(556): Illuminate\Database\Connection->runQueryCallback('insert into `bl...', Array, Object(Closure))
#3 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php(345): Illuminate\Database\Connection->run('insert into `bl...', Array, Object(Closure))
#4 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php(302): Illuminate\Database\Connection->statement('insert into `bl...', Array)
#5 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php(30): Illuminate\Database\Connection->insert('insert into `bl...', Array)
#6 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1855): Illuminate\Database\Query\Processors\Processor->processInsertGetId(Object(Illuminate\Database\Query\Builder), 'insert into `bl...', Array, 'id')
#7 [internal function]: Illuminate\Database\Query\Builder->insertGetId(Array, 'id')
#8 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(913): call_user_func_array(Array, Array)
#9 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1517): Illuminate\Database\Eloquent\Builder->__call('insertGetId', Array)
#10 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1517): Illuminate\Database\Eloquent\Builder->insertGetId(Array, 'id')
#11 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1487): Illuminate\Database\Eloquent\Model->insertAndSetId(Object(Illuminate\Database\Eloquent\Builder), Array)
#12 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1395): Illuminate\Database\Eloquent\Model->performInsert(Object(Illuminate\Database\Eloquent\Builder))
#13 /Applications/MAMP/htdocs/blog/app/controllers/CommentController.php(31): Illuminate\Database\Eloquent\Model->save()
#14 [internal function]: CommentController->addComment()
#15 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(231): call_user_func_array(Array, Array)
#16 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(93): Illuminate\Routing\Controller->callAction('addComment', Array)
#17 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(62): Illuminate\Routing\ControllerDispatcher->call(Object(CommentController), Object(Illuminate\Routing\Route), 'addComment')
#18 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(962): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'CommentControll...', 'addComment')
#19 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#20 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array(Object(Closure), Array)
#21 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1028): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#22 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(996): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#23 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(776): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#24 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(746): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#25 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#26 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#27 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#28 /Applications/MAMP/htdocs/blog/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#29 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(642): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#30 /Applications/MAMP/htdocs/blog/public/index.php(49): Illuminate\Foundation\Application->run()
#31 {main}

Next exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'author' cannot be null (SQL: insert into `blog_comments` (`author`, `comment_content`, `updated_at`, `created_at`) values (, , 2014-12-07 17:02:53, 2014-12-07 17:02:53))' in /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php:600
Stack trace:
#0 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php(556): Illuminate\Database\Connection->runQueryCallback('insert into `bl...', Array, Object(Closure))
#1 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php(345): Illuminate\Database\Connection->run('insert into `bl...', Array, Object(Closure))
#2 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php(302): Illuminate\Database\Connection->statement('insert into `bl...', Array)
#3 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php(30): Illuminate\Database\Connection->insert('insert into `bl...', Array)
#4 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1855): Illuminate\Database\Query\Processors\Processor->processInsertGetId(Object(Illuminate\Database\Query\Builder), 'insert into `bl...', Array, 'id')
#5 [internal function]: Illuminate\Database\Query\Builder->insertGetId(Array, 'id')
#6 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(913): call_user_func_array(Array, Array)
#7 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1517): Illuminate\Database\Eloquent\Builder->__call('insertGetId', Array)
#8 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1517): Illuminate\Database\Eloquent\Builder->insertGetId(Array, 'id')
#9 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1487): Illuminate\Database\Eloquent\Model->insertAndSetId(Object(Illuminate\Database\Eloquent\Builder), Array)
#10 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1395): Illuminate\Database\Eloquent\Model->performInsert(Object(Illuminate\Database\Eloquent\Builder))
#11 /Applications/MAMP/htdocs/blog/app/controllers/CommentController.php(31): Illuminate\Database\Eloquent\Model->save()
#12 [internal function]: CommentController->addComment()
#13 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(231): call_user_func_array(Array, Array)
#14 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(93): Illuminate\Routing\Controller->callAction('addComment', Array)
#15 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(62): Illuminate\Routing\ControllerDispatcher->call(Object(CommentController), Object(Illuminate\Routing\Route), 'addComment')
#16 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(962): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'CommentControll...', 'addComment')
#17 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#18 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array(Object(Closure), Array)
#19 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1028): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#20 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(996): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#21 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(776): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#22 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(746): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#23 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#24 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#25 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#26 /Applications/MAMP/htdocs/blog/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#27 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(642): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#28 /Applications/MAMP/htdocs/blog/public/index.php(49): Illuminate\Foundation\Application->run()
#29 {main} [] []
[2014-12-07 17:03:23] production.ERROR: exception 'Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException' in /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php:212
Stack trace:
#0 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php(198): Illuminate\Routing\RouteCollection->methodNotAllowed(Array)
#1 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php(145): Illuminate\Routing\RouteCollection->getOtherMethodsRoute(Object(Illuminate\Http\Request), Array)
#2 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1049): Illuminate\Routing\RouteCollection->match(Object(Illuminate\Http\Request))
#3 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1017): Illuminate\Routing\Router->findRoute(Object(Illuminate\Http\Request))
#4 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(996): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#5 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(776): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#6 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(746): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#7 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#8 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#9 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#10 /Applications/MAMP/htdocs/blog/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#11 /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(642): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#12 /Applications/MAMP/htdocs/blog/public/index.php(49): Illuminate\Foundation\Application->run()
#13 {main} [] []
0

Looks like the field auther doesn't get filled out in your controller. I think it's because of this line:

{{Form::text('username', null, array('class'=>'form-control', 'id'=>'name', 'name'=>'name'))}}

Here you create a text field. The first parameter (username in your case) already is the name given to the text field. That means adding 'name'=>'name' has no effect. Change that line to

{{Form::text('name', null, array('class'=>'form-control', 'id'=>'name'))}}

And see if it changes things.

One more thing:

If your comments can only belong to one post, you can add the post_id directly into your comments table and don't have to use an extra CommentPost model ;)

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Zolax zolax Joined 21 Jul 2014

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.