vendredi 6 janvier 2017

Undefined function: 7 ERROR: function month(timestamp without time zone) does not exist?

I have this code in controller:

 $articles = Articles::whereRaw('MONTH(created_at) ='.$month)->where('approved',1)->paginate(10);

In view i have this:

 <a href="/blog/articles/month/"> ()</a>

Problem is when i click on this link i get that error. Im using postgresql

This is entire error:

SQLSTATE[42883]: Undefined function: 7 ERROR: function month(timestamp without time zone) does not exist
LINE 1: ...elect count(*) as aggregate from "articles" where MONTH(crea...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts. (SQL: select count(*) as aggregate from "articles" where MONTH(created_at) =12 and "approved" = 1)



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2iMUFLo
via IFTTT

Aucun commentaire:

Enregistrer un commentaire