In order to connect a database, we will concentrate on the .env file. This is where you will find the configuration settings to set the database host, username and password along with a host of configurations. You may never end up using all of them. Below is an example of the .env file that is generated when you create a new Laravel project.
Here is a perfect breakdown on what a Laravel Controller is taken from the official Laravel documentation;
Instead of defining all of your request handling logic as Closures in route files, you may wish to organize this behavior using Controller classes. Controllers can group related request handling logic into a single class. Controllers are stored in the
In our routes file, we may want to add more logic to a view, this could get tiresome with loads of code showing. …
This article will show you how to send data to your laravel view. So let’s get started. For example, let’s say when a user accesses the homepage, we want to send some data to it for them to view. Head over into your code editor and go to
routes/web.php — this is where we will be passing in the data for now by hardcoding it in.
Inside the route get for the homepage we need to create a variable and pass in some tasks as an array. …