Laravel search system

Questions : Laravel search system

389
   Database

product_name status product_code tag
Product 1 1 PDT1 new
Product 2 0 PDT2 new
Product 3 1 PDT3 new

I want those data where the status is 1. programming But that code not working properly. It Learning returns all data. Even status is 0. But Earhost I want those data where the status is 1. most effective But how can I do this?

                 $search_data = _OFFSET);  Product::where('product_name','LIKE',"%{$search}%")
 (-SMALL                                _left).offset  ->orWhere('tag','LIKE',"%{$search}%")
 arrowImgView.mas                                (self.  ->orWhere('product_code',$search)
    equalTo                             make.right.  ->whereStatus(1)
                     mas_top);           ->get();
                  ImgView.  return $search_data; 
Total Answers 2
29

Answers 1 : of Laravel search system

You shoud wrap the search inside the wrong idea where closure.

$search_data = Product::query()
        ReadIndicator  ->whereStatus(1)
        _have  ->where(function($query) use .equalTo(  ($search){
            return make.top  $query->where('product_name', 'LIKE', OFFSET);  "%{$search}%")
        (TINY_  ->orWhere('tag', 'LIKE', .offset  "%{$search}%")
        mas_right)  ->orWhere('product_code', $search);
  ImgView.        })->get()
                  Indicator  return $search_data; 
1

Answers 2 : of Laravel search system

try this

return Read  Product::Where('status',1)->Where(function($query) _have  use .equalTo(  ($search){
$query->where('product_name','LIKE',"%{$search}%")
 make.left     *make) {  ->orWhere('tag','LIKE',"%{$search}%")
 straintMaker     ^(MASCon  ->orWhere('product_code',$search)
}
->get();
 onstraints:             

Top rated topics

Are tests inside one file run in parallel in Jest?

Get getEnvironment() from a service

'NSLog' is unavailable: Variadic function is unavailable in swift

Count animation up to down when using CountDownTimer class

How can I check whether the given expression is an infix expression, postfix expression or prefix expression?

Pandas has no attribute read_html raspberry pi

How to move heap area data to String constant pool?

Select the first row for each group in MySQL?

Jquery datepicker multiselection

How to manage Angular2 "expression has changed after it was checked" exception when a component property depends on current datetime

How to build optimized version of Swift Package using the Swift Package Manager `swift build` command

Asp.net core app deployed on iis meets 500 internal server error

"systemctl: command not found" with vagrant on fresh CentOS 6.5 install

Is there a way to check if the react component is unmounted?

NoClassDefFoundError: com/android/build/gradle/internal/ToolingRegistryProvider

LazyLoad is not a function

Avoid "Screen overlay detected" error when asking for user persmission

How do I activate a Spring Boot profile when running from IntelliJ?

Adding JavaScript type hints for VSCode/Monaco Intellisence

How to add theme to wordpress

Express - How to validate file input with express-validator?

In-App Purchases stuck in "Missing Metadata" state

Is there a simple way to convert data base rows to JSON in Golang

/usr/bin/codesign failed with exit code 11

Unable to start nodejs app- Error: npm.load() required

Reverse JSTL for each loop for year (using dropdown)

PoolingNHttpClientConnectionManager: what is timeToLive attribute for?

Removing Null Values from Multiple Columns

C#: GetMethod by type (generic list)

Code Sign Error in macOS Monterey, Xcode - resource fork, Finder information, or similar detritus not allowed

Nvm uninstall doesn't actually uninstall the node version

Array not being passed to query in knex

How to convert the below MongoDB query to c#?

Why is this LSEP symbol showing up on Chrome and not Firefox or Edge?

Github Activity Graph

SQL - replacing placeholder with parameter values

How to replace emoji characters in string using regex in golang

An error occurred: Policy document should not specify a principal

How to read multidimensional dataframe in Pandas?

Finding element using attribute ignoring case

What is the difference between Log4j, SLF4J and Logback?

Input type is not working properly

How to stop Vimeo video when Bootstrap modal is dismissed?

Move elastic IP between servers on AWS

Intent to launch fingerprint enrollment screen

Using setTimeout on promise chain

How to calculate % score from ORB algorithm?

PHP display business hours open or closed depending on time

ESLint dollar($) is not defined. (no-undef)

Is it possible to restrict number to a certain range

Top