master
parent
069210200e
commit
acfaa83657
|
|
@ -38,6 +38,13 @@ class KeywordsController extends AdminController
|
||||||
return KeywordResource::collection($list);
|
return KeywordResource::collection($list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function jsonOne($key)
|
||||||
|
{
|
||||||
|
$info = Keywords::where('key', $key)->firstOrFail();
|
||||||
|
|
||||||
|
return KeywordResource::make($info);
|
||||||
|
}
|
||||||
|
|
||||||
protected function grid()
|
protected function grid()
|
||||||
{
|
{
|
||||||
return Grid::make(new Keywords(), function ($grid) {
|
return Grid::make(new Keywords(), function ($grid) {
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ class KeywordResource extends JsonResource
|
||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
'key' => $this->key,
|
'key' => $this->key,
|
||||||
'type_key' => $this->type_key,
|
'type_key' => $this->type_key,
|
||||||
|
'value' => $this->value,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,5 @@ use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::group(['middleware' => 'api', 'prefix' => 'api'], function () {
|
Route::group(['middleware' => 'api', 'prefix' => 'api'], function () {
|
||||||
Route::get('keywords', [KeywordsController::class, 'json']);
|
Route::get('keywords', [KeywordsController::class, 'json']);
|
||||||
|
Route::get('keywords/{key}', [KeywordsController::class, 'jsonOne']);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue