4
0
Fork 0
panliang 2022-08-22 06:09:17 +00:00 committed by Gitee
parent 069210200e
commit acfaa83657
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 9 additions and 0 deletions

View File

@ -38,6 +38,13 @@ class KeywordsController extends AdminController
return KeywordResource::collection($list);
}
public function jsonOne($key)
{
$info = Keywords::where('key', $key)->firstOrFail();
return KeywordResource::make($info);
}
protected function grid()
{
return Grid::make(new Keywords(), function ($grid) {

View File

@ -19,6 +19,7 @@ class KeywordResource extends JsonResource
'name' => $this->name,
'key' => $this->key,
'type_key' => $this->type_key,
'value' => $this->value,
];
}
}

View File

@ -6,4 +6,5 @@ use Illuminate\Support\Facades\Route;
Route::group(['middleware' => 'api', 'prefix' => 'api'], function () {
Route::get('keywords', [KeywordsController::class, 'json']);
Route::get('keywords/{key}', [KeywordsController::class, 'jsonOne']);
});