title = "search_rentals_and_sales"
url = "/search_rentals_and_sales"
layout = "default"
is_hidden = 0
==
<?php
function onStart(){

    $query = '%' . input('q') . '%';
    $this['data'] = Tps\Shops\Models\RentalsAndSales::where(function($queryBuilder) use ($query) {
        $queryBuilder->where('name', 'LIKE', '%' . $query . '%')
                     ->orWhere('number', 'LIKE', '%' . $query . '%')
                     ->orWhere('sector', 'LIKE', '%' . $query . '%')
                     ->orWhere('description', 'LIKE', '%' . $query . '%');
        // Add more 'orWhere' calls for other fields as needed
    })->get();
    
    //dd($this['data']);

}
?>
==
<section class="crumb">
    <div class="auto_container">
        <div class="crumb_wrap">
            <div class="crumb_row">
                <a href="{{'home'|page}}" class="crumb_title">
                    <span>
                        <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
                            xmlns="http://www.w3.org/2000/svg">
                            <path
                                d="M1.25 12.88V6.91459C1.25 6.33752 1.51642 5.79278 1.97193 5.4385L6.85193 1.64294C7.52721 1.11773 8.47279 1.11773 9.14807 1.64294L14.0281 5.4385C14.4836 5.79278 14.75 6.33752 14.75 6.91459V12.88C14.75 13.9128 13.9128 14.75 12.88 14.75H10.75C10.4739 14.75 10.25 14.5261 10.25 14.25V11.6487C10.25 11.3855 10.207 11.1193 10.0677 10.896C9.88545 10.6039 9.64228 10.3523 9.35303 10.1595C8.95253 9.89251 8.48167 9.75 8 9.75C7.51833 9.75 7.04747 9.89251 6.64697 10.1595C6.35772 10.3523 6.11455 10.6039 5.93234 10.896C5.79305 11.1193 5.75 11.3855 5.75 11.6487V14.25C5.75 14.5261 5.52614 14.75 5.25 14.75H3.12C2.08723 14.75 1.25 13.9128 1.25 12.88Z"
                                stroke="#292929" stroke-width="1.5" stroke-linecap="round"
                                stroke-linejoin="round" />
                        </svg>
                    </span>
                    {{'Главная'|_}}
                </a>
                <h4 class="crumb_title">
                    {{'Результат поиска'|_}}
                </h4>

            </div>
        </div>
    </div>
</section>

 <section class="result page">
    <div class="auto_container">
        <div class="result_wrap">
            <form action="{{ 'search_rentals_and_sales'|page }}" method="GET" class="menu_search">
                <h1 class="menu_search-title">
                    {{'Результат поиска'|_}}
                </h1>

                {% if data|length == 0 %}
                    <h1 class="menu_search-title">
                        {{'Ничего не найдено'|_}}
                    </h1>

                    <p class="menu_search-txt">
                        {{'К сожалению, по вашему запросу ничего не найдено. Попробуйте воспользоваться поиском еще раз'|_}}
                    </p>
                {% endif %}

                <div class="menu_search-input">
                    <input type="text" name="q" placeholder="Что будем искать?">
                </div>

                <button class="menu_search-btn" type="submit">
                    {{'НАЙТИ'|_}}
                </button>


            </form>
            <div class="rest_box">
                {% partial 'home/rentals_and_sales/res_rentals_and_sales' data=data %}
            </div>
        </div>
    </div>
</section>