Skip to content

Commit c073b9d

Browse files
committed
fix: fix for admin post search
1 parent 2f68272 commit c073b9d

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

src/Config/binshopsblog.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
//Your custom User model
88
//Change it to \App\Models\User::class for laravel 8.x's default auth User model
9-
'user_model'=>\App\User::class,
9+
'user_model'=>\App\Models\User::class,
1010

1111
// reading progress bar is the bar which shows on top of your post when you are scrolling down the page. You can disable this feature if you want
1212
'reading_progress_bar' => true,

src/Controllers/BinshopsBlogAdminController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use BinshopsBlog\Requests\DeleteBinshopsBlogPostRequest;
1818
use BinshopsBlog\Requests\UpdateBinshopsBlogPostRequest;
1919
use BinshopsBlog\Traits\UploadFileTrait;
20+
use Swis\Laravel\Fulltext\Search;
2021

2122
/**
2223
* Class BinshopsBlogAdminController
@@ -235,7 +236,7 @@ protected function processUploadedImages(BaseRequestInterface $request, Binshops
235236
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
236237
* @throws \Exception
237238
*/
238-
public function search(Request $request)
239+
public function searchBlog(Request $request)
239240
{
240241
if (!config("binshopsblog.search.search_enabled")) {
241242
throw new \Exception("Search is disabled");

src/Views/binshopsblog_admin/index.blade.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@extends("binshopsblog_admin::layouts.admin_layout")
22
@section("content")
33

4-
@if($posts)
4+
@if(count($posts) > 0)
55
<div class='search-form-outer mb-3'>
66
<form method='get' action='{{route("binshopsblog.admin.searchblog", app('request')->get('locale'))}}' class='text-center'>
77
<input style="display: inline-block; width: 50%" type='text' name='s' placeholder='Search...' class='form-control' value='{{\Request::get("s")}}'>
@@ -107,15 +107,13 @@
107107

108108
<div class='alert alert-warning'>No posts to show you. Why don't you add one?</div>
109109
@else
110+
<div class='search-form-outer mb-3'>
111+
<form method='get' action='{{route("binshopsblog.admin.searchblog", app('request')->get('locale'))}}' class='text-center'>
112+
<input style="display: inline-block; width: 50%" type='text' name='s' placeholder='Search...' class='form-control' value='{{\Request::get("s")}}'>
113+
<input style="display: inline-block" type='submit' value='Search' class='btn btn-primary m-2'>
114+
</form>
115+
</div>
110116
<div class='alert alert-warning'>There were no results for this search!</div>
111117
@endif
112118
@endforelse
113-
114-
115-
116-
<div class='text-center'>
117-
{{$posts->appends( [] )->links()}}
118-
</div>
119-
120-
121119
@endsection

src/routes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
Route::group(['prefix' => config('binshopsblog.admin_prefix', 'blog_admin')], function () {
3838

3939
Route::get('/search',
40-
'BinshopsAdminController@searchBlog')
40+
'BinshopsBlogAdminController@searchBlog')
4141
->name('binshopsblog.admin.searchblog');
4242

4343
Route::get('/', 'BinshopsBlogAdminController@index')

0 commit comments

Comments
 (0)