You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
then I created the following methods in the Article controller to be able to insert the data
public function create()
{
return view('createArticle');
}
public function store()
{
$article = new Article();
$article->title = request('title');
$article->body = request('body');
$article->save();
}
Illuminate\Database\QueryException
SQLSTATE[HY000]: General error: 1364 Field 'user_id' doesn't have a default value (SQL: insert into articles (title, body, updated_at, created_at) values ({"it":"I try to insert the title"}, {"it":"I try to insert the body"}, 2020-12-15 09:42:35, 2020-12-15 09:42:35))
Also how can I enter data in multiple languages at the same time?
This discussion was converted from issue #248 on December 15, 2020 09:53.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I created an Article table with three fields: id, title, body.
then I created a middleware to manage languages:
then the web routes:
then I created the following methods in the Article controller to be able to insert the data
when I go to one of the following links (http://towerb.test/it/articles/create or http://towerb.test/fr/articles/create ecc) to enter the data I get the following error:
Illuminate\Database\QueryException
SQLSTATE[HY000]: General error: 1364 Field 'user_id' doesn't have a default value (SQL: insert into
articles
(title
,body
,updated_at
,created_at
) values ({"it":"I try to insert the title"}, {"it":"I try to insert the body"}, 2020-12-15 09:42:35, 2020-12-15 09:42:35))Also how can I enter data in multiple languages at the same time?
Beta Was this translation helpful? Give feedback.
All reactions