rappasoft / vault

Roles & Permissions for the Laravel 5 Framework
MIT License
103 stars 10 forks source link

users.deleted_at assumed #10

Closed martinlindhe closed 9 years ago

martinlindhe commented 9 years ago

Hello, following setup instructions i hit this:

exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users.deleted_at' in 'where clause'' in /home/vagrant/dev/l5-kvarnia/l5/vendor/laravel/framework/src/Illuminate/Database/Connection.php:288

Should be straigtforward to fix, by adding to my users table migration:

 $table->timestamp('deleted_at');

However, it could possibly be mentioned in the readme, or taken care of by the migrations this package creates?

/m

rappasoft commented 9 years ago

It is in the pre-reqs of the readme, Is easier to have the user place it there themselves instead of already having it and the plugin trying to put it back and erroring.

martinlindhe commented 9 years ago

Okay, so this is the "User model must have soft deletes enabled" step?

I did add the SoftDeletes trait to my User model as you describe in the readme, but it don't seem to get any "deleted_by" column created when i migrate.

After some poking, and reading http://laravel.com/docs/5.0/eloquent#soft-deleting

the step i missed, was in my migrations:

$table->softDeletes();

(basically same deal as in my first post) thanks for pointing me in the right direction :)

rappasoft commented 9 years ago

Make sure you add the timestamp to the model as well: http://laravel.com/docs/5.0/eloquent#soft-deleting, edit: didn't see you posted it. Glad you figured it out.