You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+55Lines changed: 55 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -129,6 +129,61 @@ After that you can search your models with:
129
129
130
130
`Post::search('Bugs Bunny')->get();`
131
131
132
+
## Constrains
133
+
134
+
Additionally to `where()` statements as conditions, you're able to use Eloquent queries to constrain your search. This allows you to take relationships into account.
135
+
136
+
If you make use of this, the search command has to be called after all queries have been defined in your controller.
137
+
138
+
The `where()` statements you already know can be applied everywhere.
139
+
140
+
```php
141
+
namespace App\Http\Controllers;
142
+
143
+
use App\Post;
144
+
145
+
class PostController extends Controller
146
+
{
147
+
/**
148
+
* Display a listing of the resource.
149
+
*
150
+
* @return \Illuminate\Http\Response
151
+
*/
152
+
public function index(Request $request)
153
+
{
154
+
$post = new Post;
155
+
156
+
// filter out posts to which the given topic is assigned
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/tntsearch#sponsor)]
0 commit comments