PHP code example of jwohlfert23 / laravel-api-query

1. Go to this page and download the library: Download jwohlfert23/laravel-api-query 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/ */

    

jwohlfert23 / laravel-api-query example snippets


use Jwohlfert23\LaravelApiQuery\BuildQueryFromRequest;

class Post {
    use BuildQueryFromRequest;
}

Post::buildFromRequest()->get();

Post::orderByDesc('id')->orderBy('name');

Post::where('name', 'Bobby')->whereHas('author', function($q) {
    $q->where('name', 'like', '%Bob%');
});

Post::with('author','comments');