Skip to content

Instantly share code, notes, and snippets.

@hmic
Last active August 16, 2017 10:22
Show Gist options
  • Save hmic/e3b4877b60045035eef85ae31f0f2b84 to your computer and use it in GitHub Desktop.
Save hmic/e3b4877b60045035eef85ae31f0f2b84 to your computer and use it in GitHub Desktop.
paginate past data
<?php
namespace App\Controller;
class AController extends AppController {
public function index() {
try {
$this->set('data', $this->paginate());
} catch(\Cake\Network\Exception\NotFoundException $e) {
$this->redirect(['page' => 1] + $this->request->query);
}
}
}
@dereuromark
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment