Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel create search

public function index(){
      // // we need to show all data from "blog" table
      // $blogs = Blog::all();
      // // show data to our view
      // return view('blog.index',['blogs' => $blogs]);

      $search = Request::get('search');
      $blogs = Blog::where('title','like','%'.$search.'%')->orderBy('id')->paginate(6);
      return view('blog.index',['blogs' => $blogs]);
    }
Comment

search in laravel 8

public function index(){
      // // we need to show all data from "blog" table
      // $blogs = Blog::all();
      // // show data to our view
      // return view('blog.index',['blogs' => $blogs]);

      $search = Request::get('search');
      $blogs = Blog::where('title','like','%'.$search.'%')->orderBy('id')->paginate(6);
      return view('blog.index',['blogs' => $blogs]);
    }
Comment

Laravel Search

// Why do this ..
$users=User :: where(function($query)use($value){
    $query->orWhere('name','like',"{$value)")
          ->orWhere('email','like',"{$value}")
          ->orWhere('title','like',"{$value}")
          ->orWhere('role','like',"{$value}%")
          ->orWhere('status','like',"{$value}%")
})->get();
//...when you can do the same with this?
$users User :: search($value)->get();
Comment

search laravel

// Employee Model
public function searchResult($search)
{
  $query = DB::table("employee") ->where('employee_name', 'LIKE', '%'.$search.'%')->get();
  return $query;
}
Comment

laravel search function

$users = User::has('posts')->withCount('posts')->orderBy('posts_count')->take(50)->get();

$userIndex = $users->search(function($user) {
    return $user->id === Auth::id();
});
Comment

PREVIOUS NEXT
Code Example
Php :: multi condition inside single if in php 
Php :: phpmyadmin add foreign key 
Php :: Laravel Model Create Artisan Commant 
Php :: php get keys of duplicate values in array 
Php :: codeigniter installation with composer 
Php :: APP_DEBUG is set to true while APP_ENV is not local 
Php :: php connect strings 
Php :: laravel collection split 
Php :: if url has certain code then php 
Php :: french special characters php 
Php :: how to get http parameters in php 
Php :: how hide empty category woocommerce wordpress 
Php :: how to maintain serial number in pagination in laravel blade 
Php :: named route with parameter laravel 
Php :: show woocommerce product variation in table php 
Php :: wordpress image size name 
Php :: php description limit 
Php :: insert multiple rows laravel 
Php :: laravel casts 
Php :: php italian date 
Php :: list() php 
Php :: format a date sting php 
Php :: create email template php 
Php :: Access-Control-Allow-Origin php laravel 
Php :: php replace br 
Php :: convertir datetime a string en php 
Php :: laravel capsule schema datatime CURRENT_TIMESTAMP 
Php :: Laravel - Query Builder Left join 
Php :: unset php return array 
Php :: codeigniter 3 where not in 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =