Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin Dashboard not available with Postgres #8

Closed
noxify opened this issue Oct 20, 2014 · 1 comment
Closed

Admin Dashboard not available with Postgres #8

noxify opened this issue Oct 20, 2014 · 1 comment

Comments

@noxify
Copy link
Contributor

noxify commented Oct 20, 2014

Hi,

at first - thanks for this package!

I have the following environment setup

  • OSX
  • MAMP (for Apache + PHP)
  • PHP 5.5.10
  • Postgres 9.3.5.1

The installation of your package was successful.

I was able to go to the login page, but after login, I got the following error message

SQLSTATE[42883]: Undefined function: 7 ERROR: function left(timestamp without time zone, integer) does not exist LINE 1: ...ct sum("hits") as aggregate from "visitors" where LEFT(creat... ^ HINT: No function matches the given name and argument types. 
You might need to add explicit type casts. (SQL: select sum("hits") as aggregate from "visitors" where LEFT(created_at, 10) = LEFT(NOW(), 10)) (View: /Applications/MAMP/htdocs/ping-admin/vendor/pingpong/admin/src/views/index.blade.php)

I have modify the

vendor/pingpong/admin/src/Pingpong/Admin/Entities/Visitor.php

to the following

    public function scopeToday($query)
    {
        //return $query->whereRaw("left(created_at, 10) = left(NOW(), 10)");
    }

I can access the admin dashboard.

Do you have any idea, how we can fix this?

Thanks!

@noxify
Copy link
Contributor Author

noxify commented Oct 21, 2014

Hi,

after changing the function to:

public function scopeToday($query)
    {
        return $query->whereRaw("SUBSTRING(CONCAT(created_at, ''), 0, 10) = SUBSTRING(CONCAT(NOW(), ''), 0, 10)");
    }

it works fine with postgres :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant