Last active
June 30, 2023 08:35
-
-
Save mohammad-fouladgar/4c37f0cc4a5e7df43f7335c35315412b to your computer and use it in GitHub Desktop.
Quick Usage of Eloquent-Builder Package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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