diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index a75a264..bfac00a 100644 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -228,7 +228,28 @@ class ClientController extends Controller 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 e52e5f5..265654c 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 d2a1903..deceed2 100644 --- a/resources/views/client/tag.blade.php +++ b/resources/views/client/tag.blade.php @@ -32,9 +32,15 @@ @@ -49,9 +55,15 @@ @@ -66,9 +78,15 @@ diff --git a/resources/views/segments/post/PostSidebar/inc/sidebar.blade.php b/resources/views/segments/post/PostSidebar/inc/sidebar.blade.php index a810c73..3931560 100644 --- a/resources/views/segments/post/PostSidebar/inc/sidebar.blade.php +++ b/resources/views/segments/post/PostSidebar/inc/sidebar.blade.php @@ -2,9 +2,9 @@

{{__("Search")}}

-
+
- + diff --git a/resources/views/segments/posts_page/GridPostListSidebar/inc/sidebar.blade.php b/resources/views/segments/posts_page/GridPostListSidebar/inc/sidebar.blade.php index a810c73..3931560 100644 --- a/resources/views/segments/posts_page/GridPostListSidebar/inc/sidebar.blade.php +++ b/resources/views/segments/posts_page/GridPostListSidebar/inc/sidebar.blade.php @@ -2,9 +2,9 @@

{{__("Search")}}

- +
- + diff --git a/resources/views/segments/posts_page/SimplePostListSideBar/inc/sidebar.blade.php b/resources/views/segments/posts_page/SimplePostListSideBar/inc/sidebar.blade.php index a810c73..3931560 100644 --- a/resources/views/segments/posts_page/SimplePostListSideBar/inc/sidebar.blade.php +++ b/resources/views/segments/posts_page/SimplePostListSideBar/inc/sidebar.blade.php @@ -2,9 +2,9 @@

{{__("Search")}}

- +
- + diff --git a/resources/views/segments/products_page/ProductGridSidebar/inc/product-sidebar.blade.php b/resources/views/segments/products_page/ProductGridSidebar/inc/product-sidebar.blade.php index 0bded06..6e1af1c 100644 --- a/resources/views/segments/products_page/ProductGridSidebar/inc/product-sidebar.blade.php +++ b/resources/views/segments/products_page/ProductGridSidebar/inc/product-sidebar.blade.php @@ -3,9 +3,9 @@

{{__("Search")}}

- +
- +