Shilpa Kalangutkar

Shilpa Kalangutkar

45 Articles Published

Articles by Shilpa Kalangutkar

45 articles

How to access images inside a public folder in Laravel?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 14-Sep-2023 33K+ Views

If you have an image stored in the public folder of Laravel, you can access or, display it in the browser using various methods. In this article, we will learn some of these methods. Assume we have the image of a flower (flower.jpg) stored in the Public folder as shown below Now let us use the image to view inside the browser. Using url() method The url() helper function helps to return you the full path i.e., it will add the HTTP or HTTPS and return the complete path for the given URL. For example, consider the following URL ...

Read More

Find and Delete Files and Directories on Linux

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 06-Jun-2023 4K+ Views

In this article we are going to understand about the find command in Linux and also how to use the find command to delete files and directories in Linux. The find command The find command in Linux is a powerful command-line utility tool that helps you search, find or filter for files and directories based on the matching pattern specified by the user and allows you to perform subsequent operations on the result you get.The operations can be printing the files found, or deleting , reading the contents etc. The file searching will be done starting from the current ...

Read More

Remote File Synchronization in Linux

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 06-Jun-2023 544 Views

In this article we are going to understand about the rsync command in Linux that deals with remote file synchronization.This article will provide practical examples on how to use rsync with the most commonly used options. Remote Synchronization or rsync is a powerful command line utility tool that takes care of synchronizing the files and directories between two machines remotely as well locally.While synchronizing the files one machine will act as the host and the next one as the destination. Linux system administrators are the most that make use of this command. You can use rsync command, to copy and ...

Read More

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

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 01-Sep-2022 2K+ Views

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 the blade template. Example 1 Inside routes/web.php I have created the following route that is calling the view hello with data ['mymsg' => 'Welcome to Tutorialspoint']. Route::get('hello', function () { return view('hello', ['mymsg' => 'Welcome to Tutorialspoint']); }); The hello.blade.php is inside resources/views folder − {{$mymsg}} ...

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 5K+ Views

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. Student Form @if (count($errors) > 0) @foreach ($errors->all() as $error) {{ $error }} @endforeach @endif Student Registration Name Email Age Address The StudentController class is as follows −

Read More

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

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 01-Sep-2022 3K+ Views

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 is the rule applied on the data : name. $validator = Validator::make( array('name' => 'Disha'), array('name' => 'required|min:5') ); As per the above the name assigned is Disha. As per the rule the name is mandatory and the minimum characters required is 5. ...

Read More

How to validate exact words in Laravel?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 01-Sep-2022 3K+ Views

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 provided by this rule has to be matched otherwise it will fail. Example 1 working with Rule::in method To work with Rule::in method you need to include the class : use Illuminate\Validation\Rule; or use Rule; $input = [ 'category' => ['ABC', 'XYZ'], ]; Validator::make($input, [ ...

Read More

How to validate Route Parameters in Laravel?

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 30-Aug-2022 11K+ Views

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 Student'; }); The routes defined inside web/routes.php are assigned a web middleware group and they have session states and CSRF protection. You can also call your controller inside routes as shown below − use Illuminate\Support\Facades\Route; use App\Http\Controllers\StudentController; Route::get('student', [StudentController::class, 'index']); Following are the route methods you can make ...

Read More

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

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 30-Aug-2022 24K+ Views

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, hence the token is verified for each session to make sure the authorized user is performing any task. Here is an example to get access to the csrf_token. To generate csrf token You can get the token in two ways. By using the $request→session()→token() By using the csrf_token() method ...

Read More

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

Shilpa Kalangutkar
Shilpa Kalangutkar
Updated on 30-Aug-2022 7K+ Views

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 hashing details are available inside config/hashing.php. The default driver has bcrypt() as the hashing to be used. Hashing Passwords To work with Hash Facade you need to include the class: Illuminate\Support\Facades\Hash Example To hash passwords you can use the make() method. Here is an example of a hash password ...

Read More
Showing 1–10 of 45 articles
« Prev 1 2 3 4 5 Next »
Advertisements