PHP code example of laraditz / saring

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

    

laraditz / saring example snippets


use Laraditz\Saring\Filterable;

class User extends Model implements AuthenticatableContract, AuthorizableContract
{
    use Filterable;
    ...
}

namespace App\Filters;

use Laraditz\Saring\Filter;

class UserFilter extends Filter
{
    public function name($value)
    {
        $this->where('name', 'LIKE', $value);
    }

    public function email($value)
    {
        $this->where('email', 'LIKE', "%$value%");
    }
}



protected $filterable = [
    'name', 'email'
];

$users = User::filter($request->all())->get();