Fix Missing Data
This commit is contained in:
@@ -94,6 +94,7 @@ class PersonController extends Controller
|
||||
*/
|
||||
public function update(PersonRequest $request, Person $family)
|
||||
{
|
||||
dd($request->toArray());
|
||||
if (Gate::forUser(auth()->user())->allows('update-person', $family)) {
|
||||
$personData = $request->only([
|
||||
'owner_user_id',
|
||||
|
||||
@@ -24,7 +24,9 @@ class PersonRequest extends FormRequest
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name_prefix' => 'string',
|
||||
'name' => 'string',
|
||||
'name_suffix' => 'string',
|
||||
'birth_place' => 'string',
|
||||
'birth_date' => 'date',
|
||||
'gender' => 'string',
|
||||
@@ -44,22 +46,8 @@ class PersonRequest extends FormRequest
|
||||
'verification_file' => 'file', // relasi file table
|
||||
'is_ktp' => 'boolean',
|
||||
'citizenship' => 'string',
|
||||
'main_address_id' => 'numeric',
|
||||
'domicile_address_id' => 'numeric',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
$citizenship = $this->is_ktp ? 'wni' : 'wna';
|
||||
|
||||
$this->merge([
|
||||
'birth_date' => empty($this->birth_date) ? $this->birth_date . " 00:00:00" : $this->birth_date,
|
||||
'updated_by' => auth()->user()->id,
|
||||
'citizenship' => $citizenship ? $citizenship : NULL
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user