why dont u add a where?
Event::Where('event_date' < today() )->get();
extjac said:
why dont u add a where?
Event::Where('event_date' < today() )->get();
My EventController.php looks
public function index()
{
$events = Event::where('datetimefrom' < today() )->get();
$events = Event::orderBy('datetimefrom', 'asc')->get();
return View::make('events.index', array(
'events' => $events
));
}
When I paste this code
$events = Event::where('datetimefrom' < today() )->get();
I get following error
Call to undefined function today()
I also tryed to put this in my Event.php model
public function today()
{
$date = new Date('now');
return $date;
}
and still the same message :(
Event::where('event_date', '<', new Date('now'))->get();
Yes, it worked!! :)) Thanks!
But How I can also pass orderBy date to my view?
$procedures = Procedure::orderBy('datetimefrom', 'asc')->get();
EventController.php
public function index()
{
$events = Event::orderBy('datetimefrom', 'asc')->get();
$events = Event::where('datetimefrom', '>', new Date('now'))->get();
// and create a view which we return - note dot syntax to go into folder
return View::make('events.index', array(
'events' => $events
));
}
$events = Event::where('datetimefrom', '>', new Date('now'))->orderBy('id', 'DESC')->get();
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community