If you need to create a form that requires users to provide a picture or some other media, this article will prove useful to you. We will be taking a look at how you create a form with a drop zone that allows users to drag-and-drop files they wish to upload as well as what you will need on your Laravel backend to store these files. This tutorial assumes you know your way around the file system of a Laravel project. Let’s do this!!!

Case Scenario

Let’s assume we need to store the name, gender and picture for each student in the…


Eloquent is an object-relational mapper (ORM) that make interacting with your database very simple. In the spirit of simplicity, this article will assume you have a basic knowledge of Laravel models, migrations, controllers and how they relate with a database. Now let’s take a look at how to use Eloquent to interact with a MySQL database using the following operations:

  1. inserts
  2. updates
  3. deletes
  4. selects

Case Scenario

Each model usually has a corresponding database table, controller and one or more migration files. Let’s assume we have a “students” table with a controller named StudentController and a model named Student. …

Case Scenario:

Before looking at returning methods, let us assume the following case scenario. We have a “students” table in a MySQL database called “dummy-data”. We wish to interact with this table using the Query Builder from our Laravel application. Each student has an id, name, age, email and address. Here are all the contents of the table acquired by running the following line of code(the created_at and updated_at columns have been excluded for brevity):

DB::table('students')->select('id', 'name', 'email', 'age', 'address')->get();

As promised in the previous tip sheet, this article will cover Query Builder selects in Laravel 8. As we mentioned in the previous article, the Query builder allows users to build complex queries using method chaining. Let’s take a look at how that is applied to select queries.

Select Queries

Query Builder select queries usually look something like this

DB::table(table_name)->where(column_name, column_value)->get();

You have a table() method to specify the table you wish to fetch data from. You then have a chain of constraining methods like the where() method, and then you have a returning method like the get() method that will trigger…

For interacting with databases, Laravel provides the query builder, a fluent interface for interacting with different types of databases with one API. It also provides Eloquent, an object-relational mapper that is built on the query builder. Assuming a MySQL database where necessary, three tip sheets, of which this article is the first, will cover how to use both the Query Builder and Eloquent for each of the following types of database queries:

  1. inserts
  2. updates
  3. deletes
  4. selects

Using the Query Builder

The query builder provides a single interface that can be used to interact with different types of database systems. It allows users to use…

Usually, the way to fill a database table is to setup a form or some other mechanism. If you happen to need to generate dummy data to test your Laravel interface, Laravel Model Factories can be useful.


This tutorial assumes that you have PHP and Composer installed on your computer. It also uses XAMPP’s Apache and MySQL installations. It is therefore assumed that the reader is familiar with XAMPP. Visit the Composer and XAMPP websites to download them.

Case Scenario:

We have a “students” table in a MySQL database called “dummy-data”. We wish to interact with this table using…

Am I the only person who remembers how vulnerable Gerard Pique can be against pacey forwards? In Barca’s 1–0 eviction from the Copa del Rey in February 2020, one of the highlight of the game was this scene in which Gerard Pique had no choice but to bring down Inaki Williams because he could not keep up.

Given the current state of Barca’s defense, most center back additions from top five teams from any of Europe’s top five leagues will be improvements to the Blaugrana back line; even more so the addition of a player of Pique’s pedigree.

For most…

After losing 2–0 to a Sevilla side without Ocampos last Wednesday, many will consider Barca the most likely between PSG and FC Barcelona to crash out of the Champions league in their Round of 16 tie. All hope is not lost for Barca though, if they can defend properly, they just might make it through.

Barca’s Scoring Form

Before their loss to Sevilla, Barca had been in pretty good scoring form. In fact, one has to go back to 8th December last year to their 3–0 defeat against Juventus to find a match in which they failed to score. Since then Barca has…

Kenpachi Zaraki

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store