PHP code example of fector / harvest

1. Go to this page and download the library: Download fector/harvest 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/ */

    

fector / harvest example snippets


use Fector\Harvest\Facades\Harvester;

/**
 * Display the resource collection
 *
 * @param Request $request
 * @return BooksCollection
 */
public function index(Request $request): BooksCollection
{
    $books = Book::where('status', 1);
    $books = Harvester::recycle($communities)->paginate();
    return new BooksCollection($communities);
}

php artisan vendor:publish

/api/books?_sort=title

/api/books?_with=authors

/api/books?_with=authors,publisher

/api/books?_select=title

/api/books?_select=title,publisher