-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pagination example #62
Comments
okey i found a way to do it, i am using laravel for my projects this code is just a sample and not a good one but it works if anyone knows a better code please share <?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
use Tumblr;
class HomeController extends Controller {
public function index($blogName, Request $request) {
$page = $request->input('page');
$consumerKey = 'ps3J8J';
$consumerSecret = 'dqcrP3';
$client = new Tumblr($consumerKey, $consumerSecret);
$post = $client->getBlogPosts($blogName, [
'limit' => 20,
'offset' => $page * 20,
]);
$blog = (new LengthAwarePaginator($post->posts, 20000, 20, $page, ['path' => $request->url()]));
return view('home', compact('blog', 'post'));
} |
Your code looks good. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can you show a pagination example usage please ?
The text was updated successfully, but these errors were encountered: