In laravel its easy to share varible from controller to view using view function but sometimes we need to share some specific information to all pages of our website for examle sharing the site settings, user info etc. so in this case we require to share a varible across the…
Tag: php
How to print database query in laravel 8 ?
Sometime to debug the MySQL query in laravel eloquent we need to print the raw MySQL query. In laravel we have multiple methods to print database query in laravel 8 and we can also print the query before executing it. Laravel eloquent method to print the query The first approach…
How to use database transaction in laravel eloquent with example ?
Database Laravel Transaction in laravel eloquent are used to execute multiple or single database operations which maintainer ACID(atomicity, consistency, isolation, and durability) property of transactions. In laravel we can archive the database transaction by DB facade. Laravel DB facade provides two methods to handle the transactions one through DB::transaction() method…
How to handle TokenMismatchException Ajax in Laravel 8 ?
Laravel by default protects the application from unauthorized commands executed from outside the application means a suspicious user wanted to perform form submission from external command. But Laravel by default creates a token for every post request which we need to verify before reaching to out application logic. TokenMismatchException is…
how to add multiple select in laravel eloquent ?
Laravel eloquent builder has rich features to modify the query. In some cases we wanted to add multiple select in laravel and modify the select statement on basis of few conditions and wanted to add some select statement on condition. so in this article we will learn to add multiple…
How to create a custom facade with example in Laravel 8 ?
In Laravel there several facades to use like DB, URL, Validator ,Request etc. Facades are used to use the class methods statically using the application service container. In this article we will learn to create our own facades with service container. Let’s start with step by step For a better…
Create custom library or custom class in Laravel 8 / 9
Laravel provides various packages and library to enhance our application features and functionalities but sometime we want our custom class in laravel to handle the few features of the application. Thus I this article i will show you to create a class and use it using the alias or directly…
How to Create Custom Helper Functions in Laravel ?
Sometimes in our application we want to create custom helper functions in laravel to use in our application, Laravel has so many helpers functions to work with strings, URL, email, array, debugging etc. so in this article i will show you to use custom helper functions in our Laravel application….
Laravel blade foreach, for and loop variable with example
Laravel blade provides easy way to iterate a long list array or loop using @foreach and @for. @foreach and @for both used same structure as php foreach and for. In this article i will show you to use @foreach and @for loop with example and also the $loop variable. Loop…
How to make component in Laravel 8 ?
This tutorial demonstrates how to make component in Laravel 8 using Blade and simple html. Laravel offers a library to construct HTML components, much like Angular or React, that can accept parameters through HTML attrutes. These components can be used anywhere within our application and are independent of controller routes….