Actually this problem i noticed a have few weeks ago.
I using Docker for Windows and laravel running on docker.
I tried using local and remote database, but nothing has changed.
What is the problem? I cant detect anything.
This page is look like good rendered. But if i change page or reload, any place is look like this in page. I tried some things but didnt work.
Not every time, just sometimes :/
list.blade.php
#extends('admin.layouts.master')
#section('title', 'Tüm Siparişler')
#section('content')
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row mb-2">
<div class="col-sm-4">
<div class="search-box me-2 mb-2 d-inline-block">
<div class="position-relative">
<form method="GET" action="{{ route('admin_order_status', $status) }}">
<input type="text" name="search" class="form-control"
value="{{ $search }}" placeholder="Arama...">
<i class="bx bx-search-alt search-icon"></i>
</form>
</div>
</div>
</div>
</div>
<div class="table-responsive">
<table class="table align-middle table-nowrap table-check">
<thead class="table-light">
<tr>
<th style="width: 20px;" class="align-middle">
<div class="form-check font-size-16">
<input class="form-check-input" type="checkbox" id="checkAll">
<label class="form-check-label" for="checkAll"></label>
</div>
</th>
<th class="align-middle">ID</th>
<th class="align-middle">Ürün</th>
<th class="align-middle">Müşteri</th>
<th class="align-middle">Fiyat</th>
<th class="align-middle">Sonraki ödeme tarihi</th>
<th class="align-middle">Durum</th>
</tr>
</thead>
<tbody>
#foreach ($orders as $item)
<tr>
<td>
<div class="form-check font-size-16">
<input class="form-check-input" type="checkbox"
id="orderidcheck{{ $item->order_id }}">
<label class="form-check-label"
for="orderidcheck{{ $item->order_id }}"></label>
</div>
</td>
<td>
<a href="{{ route('admin_order_view', $item->order_id) }}"
class="text-body fw-bold">
{{ $item->order_id }}
</a>
</td>
<td>
<a href="{{ route('admin_order_view', $item->order_id) }}"
class="text-body fw-bold">
{{-- #lang("admin/orders.type.{$item->data->product_name}") --}}
{{ $item->data->product_name }}
</a>
</td>
<td>
<a href="{{ route('admin_users_summary', $item->user_id) }}">
{{ $item->first_name }} {{ $item->last_name }}
</a>
</td>
<td>
{{ $item->amount }} ₺
</td>
<td class="fw-bold">
#if ($item->next_paid_at)
{{ Carbon\Carbon::parse($item->next_paid_at) }}
#else
-
#endif
</td>
<td>
<span
class='badge badge-pill bg-{{ config("enums.order_status_color.$item->status") }} font-size-12'>
#lang("admin/orders.$item->status")
</span>
</td>
</tr>
#endforeach
</tbody>
</table>
</div>
{!! $orders->withQueryString()->links() !!}
</div>
</div>
</div>
</div>
#endsection
Controller.php
class OrdersController extends Controller
{
public function indexByStatus(Request $request, string $status = 'all')
{
$search = $request->get('search');
$orders = Order::query();
$orders = $orders->join('users', 'users.id', '=', 'orders.user_id');
$orders = $orders->select([
'users.id as user_id',
'users.first_name',
'users.last_name',
'orders.id as order_id',
'orders.amount',
'orders.data',
'orders.payment_method',
'orders.invoice_id',
'orders.status',
'orders.next_paid_at',
]);
if ($search) {
if ($status != 'all') {
$orders->where('orders.status', $status);
}
$orders->where(function ($q) use ($search) {
return
$q->orWhere('users.first_name', 'LIKE', "%$search%")
->orWhere('users.last_name', 'LIKE', "%$search%")
->orWhere('orders.data', 'LIKE', "%$search%");
});
} else {
if ($status != 'all') {
$orders->where('orders.status', $status);
}
}
$orders = $orders->orderByDesc('orders.created_at');
$orders = $orders->paginate(10);
return view(
'admin.orders.allorders',
[
'orders' => $orders,
'search' => $search,
'status' => $status,
]
);
}
}
Model.php
class Order extends Model
{
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* #var array<int, string>
*/
protected $fillable = [
'status',
'payment_method',
'billing_period',
'data',
'user_id',
'invoice_id',
'amount',
'next_paid_at',
];
/**
* The attributes that should be hidden for serialization.
*
* #var array<int, string>
*/
protected $hidden = [];
/**
* The attributes that should be cast.
*
* #var array<string, string>
*/
protected $casts = [
'data' => 'object',
'next_paid_at' => 'timestamp',
'created_at' => 'timestamp',
'updated_at' => 'timestamp'
];
public function user()
{
return $this->hasOne(User::class, 'id', 'user_id');
}
}
Related
I have two tables employes and attendances . What I want is to sum work_time for each employe id and show in my view.
employes Table id attendances Table id employe_id work_time
I want to sum work_time column for specific employe id by date from to?. I am new to laravel so how do I do that with laravel eloquent.
Employe.php
class Employe extends Model
{
use HasFactory;
protected $fillable=['id','employe_code','employe_name','workplace'];
public function attendances(){
return $this->hasMany('App\Models\Attendance');
}
}
Attendance.php
class Attendance extends Model
{
use HasFactory;
protected $fillable=['id','employe_id','attendence_date','clock_in','clock_out','work_time','attendence_status'];
public function employe()
{
return $this->belongsTo('App\Models\employe', 'employe_id');
}
AttendanceController.php
public function attendanceReport(){
$empname = Employe::get();
return view('pages.Attendance.attendance_report', compact('empname'));
}
public function attendanceSearch(Request $request){
$empname = Employe::get();
if($request->employe_id == 0){
$emp = Attendance::whereBetween('attendence_date', [$request->from, $request->to])->get();
return view('pages.Attendance.attendance_report',compact('emp','empname'));
}
else{
$emp = Attendance::whereBetween('attendence_date', [$request->from, $request->to])
->where('employe_id',$request->employe_id)->get();
return view('pages.Attendance.attendance_report',compact('emp','empname'));
}
}
attendance_report.blade.php
<form method="post" action="{{ route('attendance.search') }}" autocomplete="off" id="sh11">
#csrf
<div class="row">
<div class="col-md-3">
<div class="form-group">
<select class="custom-select mr-sm-2"name="employe_id">
<option value="0">all</option>
#foreach($empname as $empname)
<option value="{{ $empname->id }}">{{$empname->employe_name }}</option>
#endforeach
</select>
</div>
</div>
<div class="card-body datepicker-form">
<div class="input-group" data-date-format="yyyy-mm-dd">
<span class="input-group-addon">Date</span>
<input type="text" class="form-control range-from date-picker-default" value={{ date('Y-m-d') }} required name="from">
<span class="input-group-addon">to date</span>
<input class="form-control range-to date-picker-default" value={{ date('Y-m-d') }} type="text" required name="to">
</div>
</div>
</div>
<button class="btn btn-success btn-sm nextBtn btn-lg pull-right" type="submit">{{trans('Students_trans.submit')}}</button>
</form>
#isset($emp)
<div class="table-responsive">
<table id="datatable" class="table table-hover table-sm table-bordered p-0" data-page-length="50"
style="text-align: center">
<thead>
<tr>
<th class="alert-success">#</th>
<th class="alert-success">code</th>
<th class="alert-success">name</th>
<th class="alert-success">work_time</th>
<th class="alert-success">attendence_date</th>
<th class="alert-warning">###</th>
</tr>
</thead>
<tbody>
#foreach($emp as $EMP)
<tr>
<td>{{ $loop->index + 1 }}</td>
<td>{{ $EMP->employe->employe_code }}</td>
<td>{{ $EMP->employe->employe_name }}</td>
<td>Hour {{ $EMP->work_time }} </td>
<td>{{ $EMP->attendence_date }}</td>
<td>
#if($EMP->attendence_status == 0)
<span class="btn-danger">Presence</span>
#else
<span class="btn-success">Absence</span>
#endif
</td>
</tr>
#endforeach
</table>
</div>
#endisset
you can try to add selectRaw to your releation
public function attendances(){
return $this->hasMany('App\Models\Attendance')->selectRaw('SUM(work_time) as total_work_time');
}
check the decumentation
its laravel 8 course im getting this error while using query builder but with ORM its perfectly run well. when i comment this code and use another method for getting data with query builder in AllCat() method DB::table is running perfectly
Category Controller
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Category;
use Auth;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
class CategoryController extends Controller
{
public function AllCat(){
$categories = DB::tabel('categories')
->join('users','categories.user_id','users.id')
->select('categories.*','users.name')
->latest()->paginate(5);
// $categories = Category::latest()->paginate(5);
//$categories = DB::table('categories')->latest()->paginate(5);
return view('admin.category.index',compact('categories'));
}
public function AddCat(Request $request){
$validated = $request->validate([
'category_name' => 'required|unique:categories|max:255',
],
[
'category_name.required' => 'Please Input Category Name',
'category_name.max' => 'Category Less Then 255Chars',
]);
Category::insert([
'category_name' => $request->category_name,
'user_id' => Auth::user()->id,
'created_at' => Carbon::now()
]);
// $category = new Category;
// $category->category_name = $request->category_name;
// $category->user_id = Auth::user()->id;
// $category->save();
// $data = array();
// $data['category_name'] = $request->category_name;
// $data['user_id'] = Auth::user()->id;
// DB::table('categories')->insert($data);
return redirect()->back()->with('success','Category Inserted Successfull');
}
}
Index.blade.php
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
All Category<b> </b>
</b>
</h2>
</x-slot>
<div class="py-12">
<div class="container">
<div class="row">
<div class="col-md-8">
<div class="card">
#if(session('success'))
<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong>{{ session('success') }}</strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
#endif
<div class="card-header"> All Category
</div>
<table class="table">
<thead>
<tr>
<th scope="col">SL No</th>
<th scope="col">Category Name</th>
<th scope="col">User</th>
<th scope="col">Created At</th>
</tr>
</thead>
<tbody>
<!-- #php($i = 1) -->
#foreach($categories as $category)
<tr>
<th scope="row">{{ $categories->firstItem()+$loop->index }}</th>
<td>{{ $category->category_name }}</td>
<td>{{ $category->name }}</td>
<td>
#if($category->created_at == NULL)
<span class="text-danger">No Date Set</span>
#else
{{ Carbon\Carbon::parse($category->created_at)->diffforHumans() }}</td>
#endif
</tr>
#endforeach
</tbody>
</table>
{{ $categories->links() }}
</div>
</div>
<div class="col-md-4">
<div class="card">
<div class="card-header">Add Category</div>
<div class="card-body">
<form action="{{ route('store.category') }}" method="POST">
#csrf
<div class="mb-3">
<label for="exampleInputEmail1" class="form-label">Category Name</label>
<input type="text" name="category_name" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
#error('category_name')
<span class="text-danger">{{ $message }}</span>
#enderror
</div>
<button type="submit" class="btn btn-primary">Add Category</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
Can you tell me what is wrong here
are you sure it is DB::tabel and not DB::table ?? It surely has to be DB::table
I want to make searching on table users but have got error in view on http://127.0.0.1:8000/:
Invalid argument supplied for foreach() (View:
/opt/lampp/htdocs/abonamenty/resources/views/users/index.blade.php)
And on the localhost error 404 after click search button.
"Object not found! The requested URL was not found on this server. The
link on the referring page appears to be incorrect or outdated. Tell
the author of this page about the problem. If you think this is a
server error, contact your administrator."
This is part of my controller
public function index(Request $request)
{
$data = User::sortable()->paginate(5);
return view('users.index', compact('data'))->with('i', ($request->input('page', 1) - 1) * 5);
}
public function search(Request $request)
{
$search = $request->get('search');
$data = DB::table('users')->where('surname', "%$search%")->paginate(5);
return view('users.index', ['users' => $data]);
}
My routes:
Route::get('/home', 'HomeController#index')->name('home');
Route::group(['middleware' => ['auth']], function () {
Route::resource('roles', 'RoleController');
Route::resource('users', 'UserController');
Route::resource('permissions', 'PermissionController');
Route::resource('products', 'ProductController');
Route::get('/search', 'UserController#search');
Route::get('data', 'UserController#index');
Route::get('posts', 'PostController#index');
});
My view:
#extends('layouts.app')
#section('content')
<div class="row">
<div class="col-lg-12 margin-tb">
<div class="pull-left">
<h2>Zarządzanie kontami użytkowników</h2>
</div>
<div class="col-md-4">
<form action="/search" method="get">
<div class="input-group">
<input type="search" name="search" class="form-control">
<span class="input-group-prepend">
<button type="submit" class="btn btn-primary">Wyszukaj</button>
</span>
</div>
</form>
</div>
<div class="pull-right">
<a class="btn btn-success" href="{{ route('users.create') }}"> Utwórz nowego użytkownika</a>
</div>
</div>
</div>
<br>
#if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
#endif
<table class="table table-bordered">
<tr>
<th scope="col">#sortablelink('id', 'Numer')</th>
<th scope="col">#sortablelink('name', 'Imię')</th>
<th scope="col">#sortablelink('surname', 'Nazwisko')</th>
<th scope="col">#sortablelink('showname', 'Nazwa wyświetlania')</th>
<th scope="col">#sortablelink('email', 'Email')</th>
<th>Rola</a></th>
<th width="280px">Akcja</a></th>
</tr>
#foreach ($data ?? '' as $key => $user)
<tr>
<td>{{ ++$i ?? '' ?? '' }}</td>
<td>{{ $user->name }}</td>
<td>{{ $user->surname }}</td>
<td>{{ $user->showname }}</td>
<td>{{ $user->email }}</td>
<td>
#if(!empty($user->getRoleNames()))
#foreach($user->getRoleNames() as $v)
<label class="badge badge-success">{{ $v }}</label>
#endforeach
#endif
</td>
<td>
<a class="btn btn-info" href="{{ route('users.show',$user->id) }}">Wiecej informacji</a>
<a class="btn btn-primary" href="{{ route('users.edit',$user->id) }}">Edytuj użytkownika</a>
{!! Form::open(['method' => 'DELETE','route' => ['users.destroy', $user->id],'style'=>'display:inline']) !!}
{!! Form::submit('Usuń', ['class' => 'btn btn-danger']) !!}
{!! Form::close() !!}
</td>
</tr>
#endforeach
</table>
{!! $data ?? ''->appends(request()->except('page'))->render() !!}
<!--{!! $data ?? ''->render() !!}-->
<p class="text-center text-primary"><small>ARTplus 2020</small></p>
#endsection
I think you need to change the search method
use Illuminate\Support\Facades\Input;
public function search()
{
$search =Input::get('search');
$data = DB::table('users')->where('surname', "%$search%")->paginate(5);
// Also we can check using print_r($data); die();
return view('users.index', ['users' => $data]);
}
I have a create form for creating courses, I have assigned users to these courses however for some reason it is not working anymore. I have been through my code umpteen times and I can't find anything that has changed - so i have come here for help.
To give some context below is my index.blade.php. As you can see I have previously assigned users to a course.
Create.blade.php;
#extends('layouts.app')
#section('content')
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">Create Course</div>
<div class="card-body">
<form method="POST" action="{{ route('admin.courses.store') }}" enctype="multipart/form-data">
#csrf
<div class="form-group">
<label class="required" for="name">Course Title</label>
<input class="form-control" type="text" name="title" id="id" value="{{ old('title', '') }}" required>
#if($errors->has('name'))
<div class="invalid-feedback">
{{ $errors->first('name') }}
</div>
#endif
</div>
<div class="form-group">
#can('create_courses')
{!! Form::label('Instructor', 'Instructor', ['class' => 'control-label']) !!}
{!! Form::select('Instructor[]', $instructors, Request::get('Instructor'), ['class' => 'form-control select2', 'multiple' => 'multiple']) !!}
#if($errors->has('Instructor'))
{{ $errors->first('Instructor') }}
#endif
#endcan
</div>
<div class="form-group">
<button class="btn btn-danger" type="submit">
Save
</button>
</div>
</div>
</form>
</div>
</div>
#endsection
Index.blade.php;
#extends('layouts.app')
#section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-10">
<p>
#can('create_courses')
<button type="button" class="btn btn-success">Create Course</button>
#endcan('create_courses')
</p>
<div class="card">
<div class="card-header">Courses</div>
<div class="card-body">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Course Title</th>
<th>Instructor</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
#foreach($course as $course)
<tr>
<th scope="row">{{ $course->id }}</th>
<td>{{ $course->title}}</td>
<td>{{ implode (', ', $course->instructors()->pluck('name')->toArray()) }}</td>
<td>
#can('edit_courses')
<a class="btn btn-xs btn-secondary" href="{{ route('admin.modules.index', $course->id) }}">
Modules
</a>
#endcan
</td>
<td>
#can('edit_courses')
<a class="btn btn-xs btn-primary" href="{{ route('admin.courses.edit', $course->id) }}">
Edit
</a>
#endcan
</td>
<td>
#can('delete_courses')
<form action="{{ route('admin.courses.destroy', $course->id) }}" method="POST" onsubmit="return confirm('Confirm delete?');" style="display: inline-block;">
<input type="hidden" name="_method" value="DELETE">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="submit" class="btn btn-xs btn-danger" value="Delete">
</form>
#endcan
</td>
</tr>
#endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- <div class="col-md-2 col-lg-2">
<div class="list-unstyled">
Courses
Modules
</div>
</div> -->
</div>
</div>
#endsection
CoursesController.php;
<?php
namespace App\Http\Controllers\Admin;
use Gate;
use App\User;
use App\Course;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Input;
class CoursesController extends Controller
{
public function __construct()
{
//calling auth middleware to check whether user is logged in, if no logged in user they will be redirected to login page
$this->middleware('auth');
}
public function index()
{
if(Gate::denies('manage_courses')){
return redirect(route('home'));
}
$courses = Course::all();
return view('admin.course.index')->with('course', $courses); //pass data down to view
}
public function create()
{
if(Gate::denies('create_courses')){
return redirect(route('home'));
}
$instructors = User::whereHas('role', function ($query) {
$query->where('role_id', 2); })->get()->pluck('name'); //defining instructor variable to call in create.blade.php. Followed by specifying that only users with role_id:2 can be viewed in the select form by looping through the pivot table to check each role_id
return view('admin.course.create', compact('instructors')); //passing instructor to view
}
public function store(Request $request)
{
$course = Course::create($request->all()); //request all the data fields to store in DB
$course->instructors()->sync($request->input('instructors', [])); //input method retrieves all of the input values as an array
if($course->save()){
$request->session()->flash('success', 'The course ' . $course->title . ' has been created successfully.');
}else{
$request->session()->flash('error', 'There was an error creating the course');
}
return redirect()->route ('admin.courses.index');
}
public function destroy(Course $course)
{
if(Gate::denies('delete_courses'))
{
return redirect (route('admin.course.index'));
}
$course->delete();
return redirect()->route('admin.courses.index');
}
public function edit(Course $course)
{
if(Gate::denies('edit_courses'))
{
return redirect (route('admin.courses.index'));
}
$instructors = User::whereHas('role', function ($query) {
$query->where('role_id', 2); })->get()->pluck('name');
return view('admin.course.edit')->with([
'course' => $course
]);
}
public function update(Request $request, Course $course)
{
$course->update($request->all());
if ($course->save()){
$request->session()->flash('success', $course->title . ' has been updated successfully.');
}else{
$request->session()->flash('error', 'There was an error updating ' . $course->title);
}
return redirect()->route('admin.courses.index');
}
public function show(Course $course)
{
return view('admin.course.show', compact('course'));
}
}
I am new to laravel so I would appreciate any help.
when i search it will show error
ErrorException (E_ERROR) Undefined variable: group (View: C:\xampp\htdocs\ff\Laravel-Webboard-Workshop-master\resources\views\topic\index.blade.php) Previous exceptions Undefined variable: group (0)
in topic page at line of route('topic.create', $group->id) that is code about button new topic
view/topic/index.blade.php
#extends('layouts.app')
#section('content')
<div class="container">
<div class="row">
<div class="col-md-12">
#if (! Auth::guest())
<form action="/search_topic" method="get">
<button type="submit" class="btn btn-primary" style="float:right;">Search</button>
<a style="float:right;">
<input type="search" name="search" class="form-control" >
</a>
</form>
<br><br>
<div>
<a href="{{ url('/') }}" style="text-align:left;">
<button type="button" class="btn btn-default">
<span aria-hidden="true"></span>
Back to Home
</button>
</a>
<a href="{{ route('topic.create', $group->id) }}" style="float:right;"> <!--error-->
<button type="button" class="btn btn-primary">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
New Topic
</button>
</a>
</div>
<br />
#endif
<div class="panel panel-default">
<div class="panel-heading" style="font-size: 18px;">
Group: {{ $group->title }}
</div>
<div class="panel-body">
<table class="table table-striped table-linkable table-hover">
<thead>
<tr>
<th class="text-center">Topic</th>
<th class="text-center">Posted By</th>
<th class="text-center">Posted At</th>
#if (! Auth::guest())
<th>Edit</th>
<th>Delete</th>
#endif
</tr>
</thead>
<tbody>
#foreach($topics as $topic)
<tr onclick="document.location.href = '{{ action('TopicController#show', $topic->id) }}'">
<td>{{ $topic->title }}</td>
<td class="text-center">{{ $topic->user['name'] }}</td>
<td class="text-center">{{ $topic->created_at->diffForHumans() }}</td>
#if (! Auth::guest())
<td>
#if (Auth::user()->id == $topic->user_id)
Edit
#endif
</td>
<td>
#if (Auth::user()->id == $topic->user_id)
<form method="post" class="delete_form" action="{{action('TopicController#destroy', $topic->id)}}">
{{csrf_field()}}
<input type="hidden" name="_method" value="DELETE" />
<button type="submit" class="btn btn-danger" onclick="return myFunction();">Delete</button>
<script>
function myFunction() {
if(!confirm("Are You Sure to Delete"))
event.preventDefault();
}
</script>
</form>
#endif
</td>
#endif
</tr>
#endforeach
</tbody>
</table>
<div class="text-center">
{!! $topics->links(); !!}
</div>
</div>
</div>
</div>
</div>
</div>
#endsection
model Topic.php
<?php
namespace App;
use App\Group;
use App\Topic;
use Illuminate\Database\Eloquent\Model;
class Topic extends Model
{
/**
* The attributes that are mass assignable.
*
* #var array
*/
protected $fillable = [
'title', 'body'
];
/**
* Get the Comments of a given topic.
*
* #return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function comments()
{
return $this->hasMany('App\Comment');
}
/**
* Get a user of a given topic
*
* #return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo('App\User');
}
public function group()
{
return $this->belongsTo('App\Group');
}
}
TopicController.php
<?php
namespace App\Http\Controllers;
use App\Comment;
use App\Topic;
use App\Group;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Auth;
class TopicController extends Controller
{
public function search(Request $request)
{
$search = $request->get('search');
//$groups = DB::table('groups')->where('title', 'like', '%'.$search.'%')->paginate(5);
$topics = Topic::with('user')->where('title', 'like', '%'.$search.'%')->paginate(5);
return view('topic.index', ['topics' => $topics] );
}
}
How should i do to fix this bug for search in my topic page??