Reputation: 7251
Normaly I call my database like this :
$data = array(
'one' => MyORM::paginate($this->per_page),
);
return View::make('project.index')->with($data);
But I also want to use an OrderBy so I can use:
$data = array(
'test' => MyORM::orderBy('date', 'DESC')->get(),
);
return View::make('project.index')->with($data);
But I don't know how I can "merge" the two codes?
I can also use :
$data = array(
'test2' => DB::table('martialp')
->orderBy('date', 'DESC')
->paginate(4)
);
But my class MyORM
for exemple is useless with this previous code.
Upvotes: 1
Views: 2551
Reputation: 1394
$data = MyORM::orderBy('date', 'DESC')->paginate(15);
return View::make('project.index', compact('data'));
Upvotes: 2