rest api expand, url params
This commit is contained in:
@ -36,9 +36,12 @@ class RestController
|
||||
#[NoReturn] public function actionView($id): void
|
||||
{
|
||||
$expand = $this->expand();
|
||||
$request = new Request();
|
||||
$expandParams = explode( ",", $request->get('expand') ?? "");
|
||||
$model = $this->model->where("id", $id)->first();
|
||||
if ($expand){
|
||||
$model->load($expand);
|
||||
$finalExpand = array_intersect($expandParams, $expand);
|
||||
if ($finalExpand){
|
||||
$model->load($finalExpand);
|
||||
}
|
||||
$res = [];
|
||||
if ($model){
|
||||
|
Reference in New Issue
Block a user