Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Full text search laravel mongodb

<?php

namespace AppFiltersReport;

use Closure;

class Name
{
    public function handle($request, Closure $next)
    {
        if (!request()->has('name') || request()->input('name') == null) {
            return $next($request);
        }

        return $next($request)->whereRaw(
            ['$text' => ['$search' => request()->input('name')]]
        );
    }
}
 
PREVIOUS NEXT
Tagged: #Full #text #search #laravel #mongodb
ADD COMMENT
Topic
Name
3+5 =