<?php

namespace App\Http\Controllers\Shop;

use App\Http\Controllers\Controller;
use App\Repositories\Shop\Searches;
use Illuminate\Http\Request;

class SearchController extends Controller
{
    public function search(Request $request)
    {
        $data = $request->input();
        $data['product_type'] = 'botanic';
        // $articles = Searches::getResults($request->input());
        $articles = Searches::search($request->input());
        $data = [
            'articles' => $articles,
            'articles_count' => $articles ? count($articles) : 0,
            'search' => $data,
            'product_type' => $data['product_type'],
        ];

        return view('Shop.Search.results', $data);
    }
}
