now we know how we can install laravel app and how we can start the server on
laravel application so we just need to say PHP artisan serve and this will start on
localhost 8000
we get this kind of page that's very nice but when you have the new laravel
application there are lots of folders and files are there so if you get
overwhelmed by this kind of structure don't worry about that I'm going to dive
into each and everything one by one but the first question comes in my mind that
we have just a fresh installation of laravel we have not done anything we just
have a started server so how we get these kind of things the laravel word is
written some of the links are their white background how this is going to
work and where this HTML is situated on this laravel application so we just need
to figure out these things and that's the entry point on our laravel world so
you can see it's just a base URL nothing else this means in general core PHP if
you have abc.com then what you do you will search for
index dot PHP file so let's just search for index dot PHP so I will press
command P or ctrl P on Windows and I will say index dot PHP so yes we have
this index dot PHP in public folder so let's open public folder and inside that
we have index dot PHP and we are sure that yes inside this we caught the HTML
but you can see it just a PHP file nothing else some of the things are
written but we don't have to care about these things for now so this is not
going to fall because this is not a core PHP it's a framework it's a lateral and
this laravel works totally differently and obviously efficiently so what I
recommend you to aside your core PHP knowledge
when you are trying to learn laravel because to have these things to have a
base URL we need to go to the first folder I am going to introduce you is
routes or routes whatever you want to call so this is the folder from where
you can define all your URL or URI whatever you call it so we have four
files API dot PHP channels dot PHP console dot PHP and web dot PHP the
first three we will talk about them later when the time come but now it's
time to learn about web dot PHP file if I open this file we have a PHP tag some
of the comment about this file and some kind of syntax so yes you can read this
but I am NOT going to read it so I will just remove it and what I'm going to
show you is that you can see we have a route keyword written then some coolin
coolin and then get this is actually creating a route for our application and
that route having a request of get that means a get method this function this
function get required two parameters one is first the URI of your route like you
have this URL here so you can say about or you can say contacted these kind of
things and the next is what you want to do when you hit this or when the user
hit this say URI so here what I'm going to do I'm going to just comment this one
and I'm going to say dump and inside this working so I'm going to say dump
and working so let's go here and refresh and yes you can see we are having
working dumped here this is because we had this base URL slash means Bezier so
this means whatever you do inside this function will reflect when user hit this
route and by default they are returning a view
view of NIEM welcome so that's why if I uncomment it go refresh this page yes we
have all these things this HTML but the next question comes in my mind where
this view is situated or where this welcome is situated so the next folder
I'm going to introduce you with is resources folder because inside this
resources folder you have this views so whenever you call using this helper
function called view it will look whatever you type inside the parameter
from this views folder and yes you can see inside this views folder we have a
file called welcome dot blade dot PHP but wait we said we want just welcome
view not welcome dot blade dot PHP so actually laravel uses a blade syntax or
blade template engine to form it or to have more power on our HTML that's why
it is welcome dot blade dot PHP not just welcome dot PHP this means we can use
PHP hand obviously blade on this file and that's why because every view is
suffix T with dot blade dot PHP that's why it not going to define yeah it's
obvious that if we are trying to access any view name is welcome that means it
is suffixed with dot blade dot PHP so we are not going to say that this means if
we are returning a view of welcome this is the file or content of this file is
going to return so I'm sure this laravel and these links are inside this welcome
dot plate dot PHP so let's open this file and yeah we have the doctype that
means simple HTML mock-ups and we have stylings scroll down to the body part
and then you can simply see we have written
and all these links that means we are on the correct file so to prove that this
is the actual file instead of laravel I am going to say bit fumes save this file
and go refresh and yes you can see it has not changed to bit films instead of
laravel so this is the first thing I am going to show you is that you can simply
return of view from any route so let's just do one thing let's try to create a
new route so I will say route colon colon get and inside single quotes I
will say about you can use slash about or simply about doesn't matter then say
function and then close this line returning view everything is same we are
just going to return a new view called about so what if I try to access about
page right now so if I say about on the slash about hit enter okay we are having
this error and you can see this is more customized and more user-friendly error
message this error message is Kim or this is actually formatted by using
whoops in laravel there is a package called whoops which is going to
customize and make user friendly error messages just like this and the message
is just saying one thing view about not found
and that's exactly we know we are returning a view called about but we
don't have any file inside our views folder called about dot blade dot PHP so
what if I can create about dot blade dot PHP so let's say about dot blade dot PHP
file and I will simply say here this is about no HTML
nothing else just for testing this is a so if I go yes we have a whoops error
message but if i refresh this page error message is gone and now we have this
this is about because now our about route is working and it is returning
this view called about and again if I delete this try to access this about
page and we get this error and as I told you this is because of a package called
whoops and if you go inside this package dot JSON file you can see whoops 2.0
that's the package only required for development so this means this message
is going to show only when you are developing not on the production and how
this is going to work we will see later but this is very important thing so
congratulation you have created your first route your first view and now now
from the next episode we will go deep dive into some of the new concepts so
till then good bye and if you want to learn new things and work on real
projects then head over to bit films.com slash courses section because here we
have all the udemy paid courses and some of the premium courses for this website
only so you can just subscribe to this website with little amount to unlock
everything all the videos are ad free and hello hi free this means just pure
learning so keep learning and keep watching we will meet in the next
episode till then good bye