All language subtitles for 4.saving-posts-to-the-database

af Afrikaans
ak Akan
sq Albanian
am Amharic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

Now that we have the working Post model,

we can finally save the submitted blog posts to the database.

I will first import the Post model in the Post controller file.

The Post model is inside of the App\Models directory.

And now I will scroll down to the store action because that is

where we actually need to store the blog post.

I don't want to store posts which don't pass validation,

so let's use this model after the validation code.

First, we need to create a new Post instance of the post model.

This will create a new empty post object and this is

exactly what we need because we need to create a new post

before we store it to the database.

I can now assign the user input from the request to the

post object properties of the same name.

These properties were dynamically created from the columns of the post table.

And now to actually save this new post instance to the database,

I can just use the save method.

Everything you do with model objects in the code will stay in

temporary memory until you actually use the save method to

commit the changes to the database.

And let me also modify this flash message.

Instead of getting the title and description from the request directly,

we'll get them from the post object itself.

Now let's test if all of this works as expected.

Open the Create Post page.

I will input some random title and description here.

Don't forget that description should be more than 10 characters long.

After I submit this, the post should be saved to the database.

There are no errors and this flash message looks correct so

hopefully everything worked as it should.

I will take a look at the posts table from the phpMyAdmin interface,

and here it is.

This is the blog post I submitted.

It is successfully saved to the database.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.