Shilpa Kalangutkar has Published 51 Articles

What is middleware in Laravel?

Shilpa Kalangutkar

Shilpa Kalangutkar

Updated on 01-Sep-2022 07:21:44

The middleware is a protection layer in laravel. It helps to filter the http request coming down. It acts as the middle layer between request and response. For example − Laravel will check if the user logged in is an authenticated user or not. The request has to pass through ... Read More

How to make Laravel (Blade) text field read-only?

Shilpa Kalangutkar

Shilpa Kalangutkar

Updated on 01-Sep-2022 07:20:11

Blade is a template engine that helps you to build your view display in laravel. It also helps you to use php code inside the template. The blade templates are saved as filename.blade.php and are stored inside resources/views/ folder. To understand the above question let us create a view calling ... Read More

How to remove a parameter from all Request Objects at Controller Level in Laravel?

Shilpa Kalangutkar

Shilpa Kalangutkar

Updated on 01-Sep-2022 07:17:27

To get all the field values from the html form you can make use of the Request class. The class Illuminate\Http\Request; has to be included in your controller. Example 1 This example shows the student registration form and it has fields like name, email, age and address. ... Read More

How to validate aninput field if the value is not NULL in Laravel?

Shilpa Kalangutkar

Shilpa Kalangutkar

Updated on 01-Sep-2022 07:14:03

To validate data you can make use of the Validation class. The validation helps to validate data as well as to display error messages to the user. Example 1 In the example below the make() method is used. The first argument is the data to be validated and the second ... Read More

How to validate exact words in Laravel?

Shilpa Kalangutkar

Shilpa Kalangutkar

Updated on 01-Sep-2022 07:11:53

To validate data you can make use of the Validation class. The validation helps to validate data as well as to display error messages to the user. To get the exact words to validate you can make use of Rule::in method available with laravel. Using Rule::in method whatever the values ... Read More

How to validate Route Parameters in Laravel?

Shilpa Kalangutkar

Shilpa Kalangutkar

Updated on 30-Aug-2022 14:38:13

In laravel the routes are defined inside routes/ folder.The routes are defined inside web.php file. The file is created when the laravel installation is done. Laravel routes take in a URI and a closure function as shown below − use Illuminate\Support\Facades\Route; Route::get('/student', function () { return 'Hello ... Read More

How to pass a CSRF token with an Ajax request in Laravel?

Shilpa Kalangutkar

Shilpa Kalangutkar

Updated on 30-Aug-2022 14:18:40

CSRF stands for Cross-Site Request Forgeries. CSRF is a malicious activity performed by unauthorized users acting to be authorized. Laravel protects such malicious activity by generating a csrf token for each active user session. The token is stored in the user's session. It is always regenerated if the session changes, ... Read More

How to compare two encrypted (bcrypt) passwords in Laravel?

Shilpa Kalangutkar

Shilpa Kalangutkar

Updated on 30-Aug-2022 14:10:07

In Laravel, you can make use of the Hash facade module to work with passwords. It has bcrypt for helping you store your passwords securely. The Hash facade bcrypt() method is a powerful way to hash a password. It prevents malicious users from breaking the password generated using bcrypt(). The ... Read More

How to define a route differently if a parameter is not an integer?

Shilpa Kalangutkar

Shilpa Kalangutkar

Updated on 30-Aug-2022 14:08:14

The route parameters are available inside the curly braces and the name given has alphanumeric characters. Along with alphanumeric, you can also make use of underscore when choosing the name for your route params. Syntax The syntax for route parameters is as shown below − Route::get('/user/{myid}', function ($myid) { ... Read More

How to upload files in Laravel directly into the public folder?

Shilpa Kalangutkar

Shilpa Kalangutkar

Updated on 30-Aug-2022 14:05:08

This is what we have in our public/ folder. Let us move the files uploaded inside images/ folders in public. The file upload display is as follows − The blade template for the above is as follows − Student Form ... Read More

Advertisements