Do you want us to write the query ??? Why don't you show us what you have already done and we shall take it from there ? First try with plain vanilla sql in some workbench and then try convert it to eloquent.
Jul 11, 2016
10
Level 17
Get posts from date to date
How to get posts from to knowing that i have 2 datepickers form .
this is the request array :
"_token" => ""
"from" => "2016-07-05"
"to" => "2016-07-28"
Level 88
The query is expecting some kind of format here. The best way is using the build in Carbon classes
$from = \Carbon\Carbon::today()->subMonth();
$to = \Carbon\Carbon::today();
$posts = Post::whereBetween('created_at', [$from, $to])->get();
Carbon: http://carbon.nesbot.com/docs/
1 like
Please or to participate in this conversation.