PHP code example of sevenshores / paginates

1. Go to this page and download the library: Download sevenshores/paginates library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sevenshores / paginates example snippets


// ...
use RyanWinchester\Paginates\PaginatesModels;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests, PaginatesModels;
}

class ProductsController extends Controller
{
    public function index()
    {
        $products = $this->paginate(Product::class);

        return response()->json($products);
    }
}

$products = $this->paginate(
    Product::class,
    $request->except(['

$products = $this->paginate(
    Product::with('variations'),
    $request->except(['

$products = $this->paginate(
    Product::select(['id', 'price', 'in_stock']),
    $request->except('columns')
);