Last active
August 16, 2017 10:22
-
-
Save hmic/e3b4877b60045035eef85ae31f0f2b84 to your computer and use it in GitHub Desktop.
paginate past data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍