diff --git a/app/Http/Controllers/Admin/BookController.php b/app/Http/Controllers/Admin/BookController.php index df7f15f..08ea480 100644 --- a/app/Http/Controllers/Admin/BookController.php +++ b/app/Http/Controllers/Admin/BookController.php @@ -68,6 +68,7 @@ class BookController extends BaseController * @OA\Parameter(name="sort_name", in="query", @OA\Schema(type="string"), required=false, description="排序字段名字"), * @OA\Parameter(name="sort_type", in="query", @OA\Schema(type="string"), required=false, description="排序类型"), * @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"), + * @OA\Parameter(name="keyword", in="query", @OA\Schema(type="string"), required=true, description="关键词"), * @OA\Response( * response="200", * description="暂无" @@ -78,6 +79,10 @@ class BookController extends BaseController { $all = request()->all(); $list = $this->model->with('cover')->where(function ($query) use ($all) { + if (isset($all['keyword'])) { + $query->where('title', 'like', '%' . $all['keyword'] . '%') + ->orWhere('author', 'like', '%' . $all['keyword'] . '%'); + } if (isset($all['filter']) && !empty($all['filter'])) { foreach ($all['filter'] as $condition) { $key = $condition['key'] ?? null; diff --git a/database/migrations/2025_06_25_150423_create_calendars_table.php b/database/migrations/2025_06_25_150423_create_calendars_table.php new file mode 100644 index 0000000..84d955f --- /dev/null +++ b/database/migrations/2025_06_25_150423_create_calendars_table.php @@ -0,0 +1,32 @@ +id(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('calendars'); + } +};