1. Go to this page and download the library: Download sympla/the-brick 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/ */
sympla / the-brick example snippets
public function index(Request $request)
{
$res = $res->negotiate('Models\User');
return response()->json($res);
}
namespace App\Models;
use Sympla\Search\Model\Model;
class User extends Model
{
}
public function scopeFilterByPhone($query)
{
return $query->where('phone', '<>', '');
}
public function scopeFilterByName($query)
{
return $query->where('name', Request::get('name'));
}
/**
* @negotiate Models\User
* @negotiateDesc Get and filter all users
*/
public function index(Request $request)
{
$res = $res->negotiate('Models\User');
return response()->json($res);
}
/**
* @negotiateDesc Get users with phones
*/
public function scopeFilterByPhone($query)
{
return $query->where('phone', '<>', '');
}
bash
php artisan negotiate:docgen
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.