PHP code example of aminsamadzadeh / simorgh

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

    

aminsamadzadeh / simorgh example snippets




namespace App;

use Illuminate\Database\Eloquent\Model;
use AminSamadzadeh\Simorgh\Filterable;

class User extends Model
{
    use Filterable;
}



namespace App;

use Illuminate\Database\Eloquent\Model;
use AminSamadzadeh\Simorgh\Filterable;

class User extends Model
{
    use Filterable;
    protected $filterable = ['name', 'email'];
}


namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\User;

class UserController extends Controller
{

    public function index()
    {
    	$users = User::filter(request()->all())->get();
        return view('users.index', compact('users'));
    }

}

$users = User::where('name', 'amin')->get();

$articles = Article::whereHas('images',function ($q) {
                $q->where($id, 1);
            }
        );

$users = User::whereBetween('created_at', ['1970-01-01', '1970-02-01'])->get();

$users = User::where('id', [1,2,3])->get();

$users = User::orderBy('created_at', 'desc')->get();



namespace App;

use Illuminate\Database\Eloquent\Model;
use AminSamadzadeh\Simorgh\Filterable;

class User extends Model
{
    use Filterable;
    protected $filterable = ['name', 'email'];
    protected $filterMeta = ['name' => ['op' => 'like']];
}

.
.
.

class User extends Model
{
    use Filterable;
    protected $filter_name = 'f';
    protected $filter_meta = 'fm';

}

/users?filter[created_at]=(1970-01-01,1970-02-01)