All language subtitles for 008 Middleware - Running Code Before & After Request_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic Download
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
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: WEBVTT 00:01.240 --> 00:05.740 In this lecture, I will introduce the concept of middleware. 00:06.670 --> 00:17.170 So in simplest terms, the middleware is the code that runs before and after the controller, an example 00:17.180 --> 00:25.150 job of before middleware is to limit access to only the authenticated users. 00:26.080 --> 00:34.420 Now, the example job of after middleware is to add some headers to the response. 00:38.070 --> 00:45.270 You can create your own middleware, though, it's also heavily used internally by Laravel to supply 00:45.270 --> 00:55.800 typical functionality, middleware is a piece B class and it has to have at least one method called 00:55.800 --> 00:56.430 handle. 00:57.120 --> 01:01.210 It does not have to extend any base, class or interface. 01:01.920 --> 01:11.550 These are two minimal examples of an before and after model where the perform action command is, where 01:11.580 --> 01:18.140 you'd put some extra logic if you really want to understand how to make your own middleware. 01:18.700 --> 01:24.090 It's a good idea to look at existing middleware provided with Laravel. 01:25.640 --> 01:34.850 There are three levels of applying middleware first, global essential middleware is applied on all 01:34.850 --> 01:36.110 routes always. 01:37.300 --> 01:48.700 Secondly, some is applied only in Web and API routes, all of above is configurable in the kernel file, 01:48.700 --> 01:59.500 which will take a look at in a second third level, Eastern were applied per route groups per controller 01:59.500 --> 02:00.100 class. 02:00.640 --> 02:06.510 You will learn about control classes in a bid or per individual route. 02:08.360 --> 02:14.510 Let's take a look at the colonel file, which can be found inside the app HTP folder. 02:16.870 --> 02:21.670 The middleware field defines their globally applied middleware. 02:23.520 --> 02:30.990 The middle where groups feel that defined the Web and API roots specific middleware. 02:35.000 --> 02:39.590 One of the root object methods is middleware. 02:40.660 --> 02:49.150 That way, you can apply to a group of roots or a specific route now to make it a little bit easier. 02:49.210 --> 02:54.640 You don't have to use a full class name like you've seen in the colonel file. 02:55.820 --> 03:05.870 In this colonel be filed, there is another field called Route Middleware, and it defines a thing called 03:05.870 --> 03:07.310 analysis. 03:08.240 --> 03:18.260 Now using this Elias's, you can easily apply middleware using the middleware method and passing those. 03:18.260 --> 03:22.040 Elias's using a comma separated string. 03:23.310 --> 03:31.980 For example, if I would use that Alpha Middleware on this specific route from now on, it would require 03:31.980 --> 03:35.490 the user to be authenticated to visit this route. 03:36.930 --> 03:45.360 Now, the middleware also can accept parameters and we will use it later when we cover the user authorization. 03:46.800 --> 03:52.030 Finally, let's verify if the S middleware was properly applied on this route. 03:52.740 --> 03:55.500 So currently the route looks like this. 03:55.770 --> 04:02.700 After refreshing this page, I should see some kind of error because we have no concept of authentication 04:02.700 --> 04:04.220 in our application yet. 04:05.340 --> 04:08.730 And indeed, after refreshing, you see an error. 04:11.180 --> 04:17.120 There is nothing to worry about when you will learn about authentication in Laravel, this error would 04:17.120 --> 04:18.600 just simply go away. 3579

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