Raw SQL Queries

Raw SQL Queries: Laravel interact with databases by the variety of database back-ends with raw SQL, the fluent query builder, and the Eloquent ORM. Laravel supports four types of databases: MySQL PostgreSQL SQLite SQL Server Configuration The database configuration of …

Read moreRaw SQL Queries

Laravel Validation

Laravel provides a different way to validate the applications incoming data. Laravel base controller class uses a ValidatesRequests that provides an easy method to validate incoming HTTP request with many powerful validation rules. Defining the Routes The following routes are …

Read moreLaravel Validation

Laravel Authentication

Authentication is a process of identifying user credentials. Laravel makes implementing authentication very simple. The authentication configuration file is located at config/auth.php that contains various documented options for adjusting the behavior of the authentication services. Laravel authentication facilities are made …

Read moreLaravel Authentication

Laravel Uploading Files

Retrieving Uploaded Files We can access files from an Illuminate\Http\Request. By using the file method or using the dynamic properties. The file method returns an instance of the Illuminate\Http\UploadedFile class that extends the PHP SplFileInfo class. It provides a several …

Read moreLaravel Uploading Files

Database Migrations

Database Migrations in Laravel Introduction Migrations are version control for our database. It allows our team to modify and share the applications database. Migrations are paired with schema builder to build an applications database schema quickly. The Laravel Schema façade …

Read moreDatabase Migrations

Laravel Forms

CSRF Field For defining an HTML form in our application, we should include a hidden CSRF token field in the form, so that the CSRF protection middleware can validate the request. We use the @csrf Blade directive to generate the …

Read moreLaravel Forms

Laravel Displaying Data

Display data that is passed to our Blade views by enclosing the variable in curly braces. The following route is given below:

We display the contents of the name variable like:

Blade {{ }} statements are sent through …

Read moreLaravel Displaying Data

Laravel Control Statements

Blade also provides convenient shortcuts for common control structure in PHP, such as conditional statements and loops. These shortcuts provide a very clean working with PHP structures, while also remain familiar to its PHP counterparts. If Statements         We construct if …

Read moreLaravel Control Statements

Laravel Data Views

Passing the Data Views The data should be an array with the key/value pairs while passing the information in the following (return view(‘greeting’, [‘name’ => ‘John’]);) manner. Inside the view, we can access each value by using its corresponding key …

Read moreLaravel Data Views

Laravel vs Other Frameworks

Laravel is one of the top listing PHP framework. Some of the reasons which make Laravel top listing PHP framework that are as follows: Authorization Technique. Object-Oriented Libraries. Artisan. MVC Support. Security. Database Migration. Database Template Engine. In this Pie …

Read moreLaravel vs Other Frameworks

Laravel Route Parameters

Required Parameters: We need to capture segments of the URI within our route. We are going to see how to pass parameters through two or many views inside the closure function.

Output: We need to capture a users id …

Read moreLaravel Route Parameters

Laravel Named Routes

Named Routes Named routes allow the suitable generation of URLs or redirects to specific routes. We specify a name for a route by changing the name method onto the route definition: Syntax:

We also specify a route names for …

Read moreLaravel Named Routes

Laravel Creating Views

Creating Views Views hold the HTML served by our application, and it separates our controller/application logic with the help of presentation logic. Views are stored inside the resources/views directory. A simple view is to look something like this: Since the …

Read moreLaravel Creating Views

Laravel Controller Middleware

Controller Middleware Middleware can be assigned to the controllers routes in our route files:

It is more convenient to specify middleware within our controllers constructor. Using the middleware method from our controllers constructor, we can easily assign middleware to …

Read moreLaravel Controller Middleware

Laravel Basic Routing

Basic Routing The basic Laravel routes accept a URI and a Closure, providing a straightforward method for defining routes:


Output: We dont have to create any files here, to do anything in the URL. We cant even …

Read moreLaravel Basic Routing

Laravel Basic Controllers

Controllers group relate request handling logic into a single class. They are stored in the app/Http/Controllers directory. Basic Controllers Defining Controllers: The controllers extend the base controller class included with Laravel. The base class provides a few uses to obtain …

Read moreLaravel Basic Controllers