Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel where search like with space

$search_term = $request->input('search_term');
$words = explode(' ', $search_term);
$column = 'column_name';
$data = $data->where(function ($q) use ($column, $words) {
          foreach ($words as $key => $value) {
            $q->where($column, 'like', "%{$value}%");
          }
        })->get();
Comment

PREVIOUS NEXT
Code Example
Php :: radio checked according to previous data in latravel 
Php :: php clear echo messages 
Php :: codecept run single test 
Php :: laravel softdeletes not working giving empty data 
Php :: php generate html attributes from array 
Php :: laravel many to many 
Php :: how to react on a html button click in php 
Php :: update query in laravel eloquent 
Php :: bin2hex (PHP 4, PHP 5, PHP 7, PHP 8) 
Php :: how to remove copyright footer from xenforo 2 
Php :: laravel relationship hasmany 
Php :: same name selection in phpstorm mac 
Php :: woocommerce_continue_shopping_redirect 
Php :: order review checkout page reset woocomerce 
Php :: laravel api get controller 
Php :: remove public from url laravel 7 
Php :: php specific function to Unflatten array 
Php :: PHP OOP - Traits 
Php :: hirudhi 
Php :: wordpress production mode wp-config 
Php :: Route::whereIn 
Php :: laravel task scheduler error 
Php :: Drupal config_readonly 
Php :: laravel download file from AWS s3 
Php :: show all tags 
Php :: Random select value on array factory Laravel 
Php :: undefined variable require_once 
Php :: php Display random custom content in WooCommerce shop archive loop 
Php :: laravel make request 
Php :: WordPress Creating “startupl” folder and Wrtting to .htaccess 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =