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: Route::get(‘greeting’, function () { return view(‘welcome’, [‘name’ => ‘rafia’]); }); We display the contents of the name variable …

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 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 looks something like this: Since, the view is stored at …

Read moreLaravel Creating Views

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 Resource Controllers

Laravel resource routing assigns the “CRUD” routes to a controller with the help of single line code. For E.g., If we wish to create a controller that handles all HTTP requests “photos” stored by our application using the make:controller Artisan …

Read moreLaravel Resource Controllers

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:

E.g.:

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

XAMPP Installation

install xampp on windows XAMPP is a free & open-source stack package which is developed by Apache, mainly it consists of Apache HTTP server, Maria DB database for scripts written in the PHP and Perl programming languages. XAMPP makes the …

Read moreXAMPP Installation