fdisotto / SlimBlog

Simple Blog written with Slim Framework
GNU General Public License v3.0
102 stars 39 forks source link

Error : #19

Closed ogacitua closed 10 years ago

ogacitua commented 10 years ago

When i try to disable / enable and edit a post, I get this:

Details

Type: Illuminate\Database\Eloquent\MassAssignmentException
Message: active
File: /Users/oscargacitua/Documents/Dev/slimblog/vendor/illuminate/database/Illuminate/Database/Eloquent/Model.php
Line: 333
Trace

#0 /Users/oscargacitua/Documents/Dev/slimblog/vendor/illuminate/database/Illuminate/Database/Eloquent/Model.php(1231): Illuminate\Database\Eloquent\Model->fill(Array)
#1 /Users/oscargacitua/Documents/Dev/slimblog/src/routes/admin.route.php(278): Illuminate\Database\Eloquent\Model->update(Array)
#2 [internal function]: {closure}('4')
#3 /Users/oscargacitua/Documents/Dev/slimblog/vendor/slim/slim/Slim/Route.php(441): call_user_func_array(Object(Closure), Array)
#4 /Users/oscargacitua/Documents/Dev/slimblog/vendor/slim/slim/Slim/Slim.php(1314): Slim\Route->dispatch()
#5 /Users/oscargacitua/Documents/Dev/slimblog/vendor/slim/slim/Slim/Middleware/Flash.php(85): Slim\Slim->call()
#6 /Users/oscargacitua/Documents/Dev/slimblog/vendor/slim/slim/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call()
#7 /Users/oscargacitua/Documents/Dev/slimblog/vendor/slim/slim/Slim/Middleware/SessionCookie.php(110): Slim\Middleware\MethodOverride->call()
#8 /Users/oscargacitua/Documents/Dev/slimblog/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php(67): Slim\Middleware\SessionCookie->call()
#9 /Users/oscargacitua/Documents/Dev/slimblog/vendor/slim/slim/Slim/Slim.php(1261): Slim\Middleware\PrettyExceptions->call()
#10 /Users/oscargacitua/Documents/Dev/slimblog/public/index.php(75): Slim\Slim->run()
#11 {main}

Is there any solution? Thanks ! :D :smiley:

fdisotto commented 10 years ago

Have other details about the error? Have you modified the script? Thanks :)

ogacitua commented 10 years ago

I write a post without any problem, then try to disable or enable the post throws me an error on the line where it updates the entry in the database.

For example , deactivate function :

$post->update(array('active' => 'false'));
fdisotto commented 10 years ago

I think the problem is this: http://laravel.com/docs/eloquent#mass-assignment

After work I'll try this and if there are no problem I update the repo

ogacitua commented 10 years ago

When replacing the line ( 273 and 288 in routes/admin.route.php)

  $post = Posts::where('id', '=', $id)->first();

For this,

  $post = Posts::where('id', '=', $id);

The error no longer appears, what do you think?

EDIT : It seems everything can be solved by removing the section "->first()"

fdisotto commented 10 years ago

Good, tonight I try this solution and update repo ;) Thank you :+1:

fdisotto commented 10 years ago

Pushed :+1: Many thanks bro!