GithubHelp home page GithubHelp logo

Comments (8)

janhartigan avatar janhartigan commented on June 9, 2024

Hey @guiguidoc, can you tell me where you're getting this error? What action are you performing?

from laravel-administrator.

guiguidoc avatar guiguidoc commented on June 9, 2024

When I access to the index page of a model

from laravel-administrator.

janhartigan avatar janhartigan commented on June 9, 2024

I'm looking into this at the moment. To give you an idea of where I'm coming from...I only ever tested this in MySQL! I'm actually really happy that you posted this here because I was curious to see what happens in postgresql. I'm going to try to set up a postgresql database today and isolate the issue.

from laravel-administrator.

janhartigan avatar janhartigan commented on June 9, 2024

Hey @guiguidoc. I've come up with a fix for this that should account for all possible scenarios. I couldn't cast the $id as an integer because sometimes people use non-integer values for ids. Instead, I changed the default $id value from boolean false (which PostgreSQL has an issue with) to integer 0. This should solve your issue, but please let me know if it hasn't. You can either grab the 2.3.0 source or make the changes from that commit directly (it's really simple...just a single line).

from laravel-administrator.

kentvv avatar kentvv commented on June 9, 2024

Hey janhartigan,
Thanks for the fix, Am now running your example app fine on pages Admin, Actors and Box office .
However i now get an error when viewing 'Films' and 'Theatre'

SQLSTATE[42883]: Undefined function: 7 ERROR: function format(numeric, integer) does not exist
LINE 1: ...films.film_id) AS num_actors, (SELECT CONCAT('$', FORMAT(SUM...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.

SQL: SELECT DISTINCT films.id, films.*, (SELECT CONCAT(directors.first_name, ' ', directors.last_name) FROM directors WHERE films.director_id = directors.id) AS director_name, (SELECT COUNT(actors_films.id) FROM actors_films WHERE films.id = actors_films.film_id) AS num_actors, (SELECT CONCAT('$', FORMAT(SUM(box_office.revenue), 2)) FROM box_office WHERE films.id = box_office.film_id) AS box_office FROM "films" GROUP BY "films"."id" ORDER BY "films"."id" DESC LIMIT 20 OFFSET 0

Bindings: array (
)

Let me know if you want a stack trace.

And, Thanks for your work on this bundle. Looks good.

from laravel-administrator.

janhartigan avatar janhartigan commented on June 9, 2024

Hey @kentvv. The examples use some MySQL functions (such as FORMAT) in the selects. If you're using PostgreSQL, you should give this a look: http://stackoverflow.com/questions/5419199/how-to-format-money-in-postgresql. So, for example, replace FORMAT on this line with to_char.

from laravel-administrator.

kentvv avatar kentvv commented on June 9, 2024

Perfect. Thanks for that.

from laravel-administrator.

janhartigan avatar janhartigan commented on June 9, 2024

Great...I'm glad that it worked. So now I sort of know that it works in PostgreSQL! Woot. You guys have really helped me out on this one :)

from laravel-administrator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.