diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index a75a2641..bfac00a2 100644 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -228,7 +228,28 @@ public function submitComment(Request $request) public function search(Request $request) { - + $q = trim($request->input('q')); + if (mb_strlen($q) < 3) { + return abort(403, __('Search word is too short')); + } + $q = '%'.$q.'%'; + $posts = Post::where('status', 1)->where(function($query) use ($q) { + $query->where('title', 'LIKE', $q) + ->orWhere('subtitle', 'LIKE', $q) + ->orWhere('body', 'LIKE', $q); + })->paginate(100); + $products = Product::where('status', 1)->where(function($query) use ($q) { + $query->where('name', 'LIKE', $q) + ->orWhere('excerpt', 'LIKE', $q) + ->orWhere('description', 'LIKE', $q); + })->paginate(100); + $clips = Clip::where('status', 1)->where(function($query) use ($q) { + $query->where('title', 'LIKE', $q) + ->orWhere('body', 'LIKE', $q); + })->paginate(100); + $title = __('Search for') . ': ' . $request->input('q'); + $subtitle = ''; + return view('client.tag', compact('posts', 'products', 'clips', 'title', 'subtitle')); } public function group($slug) diff --git a/resources/sass/client-custom/_general.scss b/resources/sass/client-custom/_general.scss index e52e5f50..265654c6 100644 --- a/resources/sass/client-custom/_general.scss +++ b/resources/sass/client-custom/_general.scss @@ -155,3 +155,10 @@ body { } } + + +.x64-img{ + width: 64px; + height: 64px; + object-fit: cover; +} diff --git a/resources/views/client/tag.blade.php b/resources/views/client/tag.blade.php index d2a19030..deceed24 100644 --- a/resources/views/client/tag.blade.php +++ b/resources/views/client/tag.blade.php @@ -32,9 +32,15 @@
+ {{$post->subtitle}} +
+ {{$product->excerpt}} +
+ {{Str::limit(strip_tags($clip->body))}} +