<?php

namespace App\Http\Controllers\Shop;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

use App\Repositories\Shop\Searches;

class SearchController extends Controller
{
    public function search(Request $request)
    {
        $data = [
            'articles' => Searches::getResults($request->input()),
            'articles_count' => $data['articles'] ? count($data['articles']) : 0,
            'search' => $request->input(),
            'product_type' => $request->input('product_type'),
        ];
        return view('Shop.Search.results', $data);
    }
}
