Skip to content

Instantly share code, notes, and snippets.

@mohammad-fouladgar
Last active June 30, 2023 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohammad-fouladgar/4c37f0cc4a5e7df43f7335c35315412b to your computer and use it in GitHub Desktop.
Save mohammad-fouladgar/4c37f0cc4a5e7df43f7335c35315412b to your computer and use it in GitHub Desktop.
Quick Usage of Eloquent-Builder Package
<?php
namespace App\Http\Controllers;
use App\User;
use Illuminate\Http\Request;
use Fouladgar\EloquentBuilder\EloquentBuilder;
class UserController extends Controller
{
public function index(Request $request)
{
$users = app(EloquentBuilder)
->model(User::class)
->filters($request->all())
->thenApply()
return $users->get();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment