Column not found: 1054 Unknown column 'categories.deleted_at' in 'where clause'
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'categories.deleted_at' in 'where clause' (SQL: select (select count(1) from categories as c1, categories c2 where categories.deleted_at is null and c1.id < c2.id and (c1._lft=c2._lft or c1._rgt=c2._rgt or c1._lft=c2._rgt or c1._rgt=c2._lft)) as duplicates limit 1)
D:\wamp64\www\app\vendor\laravel\framework\src\Illuminate\Database\Connection.php:750
D:\wamp64\www\app\vendor\laravel\framework\src\Illuminate\Database\Connection.php:706
D:\wamp64\www\app\vendor\laravel\framework\src\Illuminate\Database\Connection.php:349
D:\wamp64\www\app\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php:1614
D:\wamp64\www\app\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php:1600
D:\wamp64\www\app\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php:1583
D:\wamp64\www\app\app\src\Model\nestedset\QueryBuilder.php:611
D:\wamp64\www\app\app\src\Model\nestedset\QueryBuilder.php:742
D:\wamp64\www\app\app\src\Model\nestedset\QueryBuilder.php:754
D:\wamp64\www\app\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php:3489
D:\wamp64\www\app\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php:3503
D:\wamp64\www\app\app\test\src\nestedset\NodeTest.php:122
D:\wamp64\www\app\app\test\src\nestedset\NodeTest.php:122
the issue is : assign an alias to the the orignal table name "categories " , but eloquent use it in the deleted_at check,
This looks like an issue with the way the SoftDeletes global query scope gets the fully qualified table name. See https://github.com/laravel/framework/issues/13567
@jimrobinson-croud do you konw how to fix it?
@michaelqxd Not at the moment unfortunately. I'll comment with a solution if/when I find one.
@lazychaser I supposed it used to work? Otherwise it would not advertise as support softdelete. Do you have an idea up to which Laravel version that it's working?
Just for your information, the issue is with package Illuminate/Database as @jimrobinson-croud mentioned.
At the time of writing, the latest stable version available on Packagist is v5.2.37. The release before it is v5.2.32.
I used phpunit test case came with this package, and it failed with Illuminate/Database v5.2.37, but passed with v5.2.32.
At the moment I'll just limit "laravel/framework": "5.2.32", in my project's composer.json. @michaelqxd
P/S: FWIW, phpunit.php does not work out of the box either....
@justinmoh sorry, I'm not able to do any work on the package right now
@justinmoh Thanks, i will try v5.2.32
This should be fixed as of v4.1.4
Still not fixed in 5.4.27 :(
Actually I just added a new column deleted_at to resolve this issue.