Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
if function get json:api format, then validation ant creation in data…
…base will works
  • Loading branch information
Julius Šmatavičius committed Dec 19, 2018
commit e21dec4b9756cee2370225c5728ccb4ce031a4b4
11 changes: 8 additions & 3 deletions src/Http/Controllers/Api/BaseApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,15 @@ protected function authorizeAction($policyMethod, $requestedObject = null)
public function validateObject($id = null)
{
$input = $this->request->input();
//TODO get rules custom validator instead of model?
if (isset($input['data']) and isset($input['data']['attributes'])) {
$input = $input['data']['attributes'];
}

$model = $this->repository->makeModel();
$this->validate($this->request, $model->getRules($id));

return $input;
return $this->getValidationFactory()->make(
$input,
$model->getRules($id)
)->validate();
}
}