“Cari di Laravel 8” Kode Jawaban

Laravel membuat pencarian

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]);
    }
SAMER SAEID

Cari di 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]);
    }
Precious Peacock

Cari Laravel

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

fungsi pencarian Laravel

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

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

Jawaban yang mirip dengan “Cari di Laravel 8”

Pertanyaan yang mirip dengan “Cari di Laravel 8”

Lebih banyak jawaban terkait untuk “Cari di Laravel 8” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya