Похожие чаты

Hello fam, I'm kinda new to eloquent. I'm sending a JavaScript

array that I want to save on the server with axios.
The data is like this:

data = {"data1": data1, "data2": data2};

Where data1 and data2 are both arrays.

On the server, my database table is like this:

$table->interger('id');
$table->text('data1')->nullable();
$table->text('data2')->nullable ();
$table->unsignedInteger('user_id');

And I set the fillable in the model for data1 and data2.

Do I still to do json.stringify on both data at the frontend before sending to data?

Please help me out.

2 ответов

4 просмотра

You must do stringify in js for sending it to the server, and json_encode before you put it in the database

Just use the response object which comes with a json helper method in it. It goes like this 'return response()->json(data)'

Похожие вопросы

Обсуждают сегодня

Вопрос по диагностике ошибок (я знаю в чем, в данном конкретном примере, я знаю, как исправить, пример модельный, понятно, что в реальности бывает намного запутаннее). module...
ⰄⰎⰋⰐⰐⰑⰛⰤⰧⰧⰩⰄ ⰊⰑⰁⰓⰡⰛⰦⰕⰫ
10
Тут кста кто-нибудь NeoVim использует?
Simple Sorcerer
13
А чем вам питонисты не угодили?😂
.
79
Есть какой-нибудь для Delphi/FPC T*Compression(Decompression)Stream на базе LZ4/Zstd/любой другой быстрый(и хорошо сжимающий) алгоритм А ещё лучше в pure pascal А ещё лучше од...
notme
52
New Hedera drama. Is Hashinals on chain or not on chain?
Perfect Ability
16
Can someone explain me the difference of the stated quote on Quants homepage between R3 and Quant? „R3 brings its ability to deliver complex pioneering projects for regulate...
Carlson
2
Asus, норм фирма для ноутов?
Артем Записной
20
guys, why is it taking days for my node to sync? is this normal?
Big Chiano
10
А дальше что?.. Записать в файл, потом в Код?.. И потом разбирать как-то?..
Хаскель Моисеевич Гопник
14
Ребят немного глупый вопрос, но я правильно понимаю что неполнота по геделю означает наличие парадокса?
Smith
9
Карта сайта