File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -532,3 +532,36 @@ $query = (new Percolate($conn))
532
532
533
533
Execute the ` CALL PQ ` .
534
534
535
+ ## Laravel
536
+
537
+ Laravel's dependency injection and realtime facades brings more convenience to SphinxQL Query Builder usage.
538
+
539
+ ``` php
540
+ // Register connection:
541
+ use Foolz\SphinxQL\Drivers\ConnectionInterface;
542
+ use Foolz\SphinxQL\Drivers\Mysqli\Connection;
543
+ use Illuminate\Support\ServiceProvider;
544
+
545
+ class AppServiceProvider extends ServiceProvider
546
+ {
547
+ public function register()
548
+ {
549
+ $this->app->singleton(ConnectionInterface::class, function ($app) {
550
+ $conn = new Connection();
551
+ $conn->setParams(['host' => 'domain.tld', 'port' => 9306]);
552
+ return $conn;
553
+ });
554
+ }
555
+ }
556
+
557
+ // In another file:
558
+ use Facades\Foolz\SphinxQL\SphinxQL;
559
+
560
+ $result = SphinxQL::select('column_one', 'colume_two')
561
+ ->from('index_ancient', 'index_main', 'index_delta')
562
+ ->match('comment', 'my opinion is superior to yours')
563
+ ->where('banned', '=', 1)
564
+ ->execute();
565
+ ```
566
+
567
+ Facade access also works with ` Helper ` and ` Percolate ` .
You can’t perform that action at this time.
0 commit comments