Привет, я использую люмен Laravel для публикации API, я хочу хранить данные через почтальона с типом json необработанных данных, таких как:
[
{
"taskcode": "TASK-5001",
"accno": "ACCNO-03346",
"accountname": "Joko saputra",
"tasktype": "COLL",
"collectfee": "125000",
"ospokok": "100000000",
"tenor": "50",
"installment": "2000000",
"assigndate": "2020-03-24",
"validuntil": "",
"collectorcode": "288",
"custno": "CUST0900",
"custtype": "INDIVIDUAL",
"gender": "MALE",
"maritalsts": "Married",
"birthdate": "1980-08-17",
"birthplace": "Jakarta",
"custaddress": "Jalan Belleza",
"custphoneno": "080989999",
"custemail": "waridin@gmail.com",
"mobileno": "080989999",
"mobileno2": "080989999",
"negativests": "NEGATIVE",
"negativedesc": "Arrogant",
"relativesname": "Wardino",
"relativestype": "Saudara",
"relativesaddress": "Jalan Permata HIjau",
"relativesphone": "08989999",
"spousename": "Angel",
"spousebirthdate": "1990-04-04",
"spousebirthplacce": "Bogor",
"spouseaddress": "Jalan Belleza",
"spousemobileno": "08989999",
"spouseoffice": "Belleza Office Tower",
"spouseofficephoneno": "08989999",
"spousejobname": "Data Analyst",
"companyname": "Jari Solusi",
"companyaddress": "Belleza Office Tower",
"companyphone": "080989999",
"companyfax": "080989999",
"jobname": "Web Developer",
"merkname": "Toyota",
"modelname": "Camry",
"typename": "Sedan",
"categoryname": "Small Car",
"caryear": "2016",
"color": "Black",
"chassisno": "1234567890987654321",
"engineno": "1234567890987654321",
"policeno": "B6789LKO",
"route": "",
"collbussname": "",
"latitude": "0",
"longitude": "0",
"detail": [
{
"duedate": "2018-03-01",
"period": 5,
"dpd": 41,
"angstung": 1200000,
"denda": 120000
},
{
"duedate": "2018-03-01",
"period": 6,
"dpd": 11,
"angstung": 1000000,
"denda": 50000
}
]
},
{
"taskcode": "TASK-2355",
"accno": "ACCNO-81816190",
"accountname": "Sapri",
"tasktype": "COLL",
"collectfee": "125000",
"ospokok": "100000000",
"tenor": "50",
"installment": "2000000",
"assigndate": "2020-03-24",
"validuntil": "",
"collectorcode": "288",
"custno": "CUST0900",
"custtype": "INDIVIDUAL",
"gender": "MALE",
"maritalsts": "Married",
"birthdate": "1980-08-17",
"birthplace": "Jakarta",
"custaddress": "Jalan Belleza",
"custphoneno": "080989999",
"custemail": "waridin@gmail.com",
"mobileno": "080989999",
"mobileno2": "080989999",
"negativests": "NEGATIVE",
"negativedesc": "Arrogant",
"relativesname": "Wardino",
"relativestype": "Saudara",
"relativesaddress": "Jalan Permata HIjau",
"relativesphone": "08989999",
"spousename": "Angel",
"spousebirthdate": "1990-04-04",
"spousebirthplacce": "Bogor",
"spouseaddress": "Jalan Belleza",
"spousemobileno": "08989999",
"spouseoffice": "Belleza Office Tower",
"spouseofficephoneno": "08989999",
"spousejobname": "Data Analyst",
"companyname": "Jari Solusi",
"companyaddress": "Belleza Office Tower",
"companyphone": "080989999",
"companyfax": "080989999",
"jobname": "Web Developer",
"merkname": "Toyota",
"modelname": "Camry",
"typename": "Sedan",
"categoryname": "Small Car",
"caryear": "2016",
"color": "Black",
"chassisno": "1234567890987654321",
"engineno": "1234567890987654321",
"policeno": "B6789LKO",
"route": "",
"collbussname": "",
"latitude": "0",
"longitude": "0",
"detail": [
{
"duedate": "2018-03-01",
"period": 5,
"dpd": 41,
"angstung": 1200000,
"denda": 120000
},
{
"duedate": "2018-03-01",
"period": 6,
"dpd": 11,
"angstung": 1000000,
"denda": 50000
}
]
}
]
я делаю переменную $input=$this->$request->all()
и пытаясь сохранить данные в базе данных с помощью db:create($input)
, когда я отправляю данные, мои данные запроса появляются в ответе, но не сохраняются в моей базе данных, в моей таблице базы данных появляются новые данные, а просто отображается пустая строка. Помогите, пожалуйста, как сохранить тип данных json в почтальоне и сохранить его в базе данных? извините, если мой английский sh плохой.