laravel-nestedset
laravel-nestedset copied to clipboard
not worked for Postgresql?
when i use withDepth()->find($id), somethin wrong happend; i noted strict mode,but my db is Postgresql.
@niuny-mb ljfl-api % php artisan tinker Psy Shell v0.9.12 (PHP 7.3.9 — cli) by Justin Hileman
$area = Area::withDepth()->find(24); [!] Aliasing 'Area' to 'App\Models\Area' for this Tinker session. Illuminate/Database/QueryException with message 'SQLSTATE[42803]: Grouping error: 7 ERROR: column "_d.name" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: ...lft" between "_d"."_lft" and "_d"."_rgt" order by "name" asc... ^ (SQL: select *, (select count(1) - 1 from "areas" as "_d" where "areas"."_lft" between "_d"."_lft" and "_d"."_rgt" order by "name" asc) as "depth" from "areas" where "areas"."id" = 24 order by "name" asc limit 1)'
This is also doesn't work with sqlite
Same problem!