Category: Laravel

  • Authentication

    Authentication is the process of identifying the user credentials. In web applications, authentication is managed by sessions which take the input parameters such as email or username and password, for user identification. If these parameters match, the user is said to be authenticated. Command Laravel uses the following command to create forms and the associated…

  • CSRF Protection

    CSRF refers to Cross Site Forgery attacks on web applications. CSRF attacks are the unauthorized activities which the authenticated users of the system perform. As such, many web applications are prone to these attacks. Laravel offers CSRF protection in the following way − Laravel includes an in built CSRF plug-in, that generates tokens for each…

  • Contracts

    Laravel contracts are a set of interfaces with various functionalities and core services provided by the framework. For example, Illuminate\Contracts\Queue\Queue contract uses a method which is needed for queuing jobs and Illuminate\Contracts\Mail\Mailer uses the method for sending emails. Every contract defined includes corresponding implementation of the framework. All the Laravel contracts are available in the GitHub repository as mentioned…

  • Facades

    Facades provide a static interface to classes that are available in the application’s service container. Laravel facades serve as static proxies to underlying classes in the service container, providing the benefit of a terse, expressive syntax while maintaining more testability and flexibility than traditional static methods. How to create Facade The following are the steps to create Facade in Laravel −…

  • Event Handling

    Events provide a simple observer implementation which allows a user to subscribe and listen to various events triggered in the web application. All the event classes in Laravel are stored in the app/Events folder and the listeners are stored in the app/Listeners folder. The artisan command for generating events and listeners in your web application is shown below −…

  • Error Handling

    Most web applications have specific mechanisms for error handling. Using these, they track errors and exceptions, and log them to analyze the performance. In this chapter, you will read about error handling in Laravel applications. Important Points Before proceeding further to learn in detail about error handling in Laravel, please note the following important points…

  • Ajax

    Ajax (Asynchronous JavaScript and XML) is a set of web development techniques utilizing many web technologies used on the client-side to create asynchronous Web applications. Import jquery library in your view file to use ajax functions of jquery which will be used to send and receive data using ajax from the server. On the server side…

  • Sending Email

    Laravel uses free feature-rich library SwiftMailer to send emails. Using the library function, we can easily send emails without too many hassles. The e-mail templates are loaded in the same way as views, which means you can use the Blade syntax and inject data into your templates. The following table shows the syntax and attributes of send function −…

  • File Uploading

    Uploading Files in Laravel is very easy. All we need to do is to create a view file where a user can select a file to be uploaded and a controller where uploaded files will be processed. In a view file, we need to generate a file input by adding the following line of code.…

  • Validation

    Validation is the most important aspect while designing an application. It validates the incoming data. By default, base controller class uses a ValidatesRequests trait which provides a convenient method to validate incoming HTTP requests with a variety of powerful validation rules. Available Validation Rules in Laravel Laravel will always check for errors in the session data, and…