Moving From Routes to Controllers in Laravel

Moving From Routes to Controllers in Laravel

If you wanted to, you could build a pretty substantial application and never make use of a controller. How could this be? Well, we saw in our introduction to basic routing and views that we can pass a closure to the second argument of a Route::get() request. The drawback is that pretty soon, you are going to have a routes file the size of Manhattan, and that is probably not ideal.…

How To Get Started With Eloquent In Laravel

How To Get Started With Eloquent In Laravel

Eloquent makes use of the Active Record pattern adored by software developers far and wide. Active Record was originally named by the software developer Martin Fowler when he discussed it in his book titled Patterns of Enterprise Application Architecture. It is a pattern where an Object maps to a table in a database. The object’s properties usually correspond to the columns in the given table. It’s a convenient and easy to use pattern, and Eloquent is a great version of active record.…

Getting Your Database Set Up For Use With Laravel

set up laravel database

Now that we’ve covered the most simple introduction to Laravel, let’s take a moment to get ready to work with a database so we can make use of the Query Builder or Eloquent. You have many options to choose from such as sqlite, pgsql, redis, and mysql. MySql is far and away the most used option, so that is what we’ll look at here. In addition, we can work with the database via the command line, or from a graphical user interface such as phpMyAdmin.…

How To Pass Data To Views In Laravel

How To Pass Data To Views In Laravel

In this tutorial, we’ll start looking at how we can take variable data, and pass it to our views to be rendered in the Browser. This approach adheres to the Model View Controller architecture. In this most recent series of tutorials on Laravel, we have not yet talked about Models that typically deal with retrieving data, but we have covered the basics of Routing and Views.…