Web Prepration

Web Concept Tutorials

Larave 9, Laravel, Laravel 7, Laravel 8

In this article, I am going to explain laravel 9 many to many relationship. This tutorial give you simple example of laravel 9 belongstomany tutorial. This tutorial will give you simple example of laravel 9 many to many sync. So in this article, you can understand how to create many-to-many relationships with migration with a foreign key schema for one to many relationships, use sync with a pivot table, create records, attach records, get all records, delete, update, where condition and everything related to many to many relationship. Many to Many Relationship will use  “belongsToMany()”  for relation. So in this example, i will create  “posts”, “category” and “post_category” tables. each table is connected with each other. now we will create many to many relationships with each other by using the laravel Eloquent Model. We will first create database migration, then model, retrieve records and then how to create records too.

Laravel, Laravel 7, Laravel 8, Others

In this article, we will cover “How to implement laravel conditional query”. I would like to show your laravel eloquent if condition but laravel added a new function when(), using when() you can ignore to write manually if conditional statement and else statement. I will give you some example how to use it when and how to write if condition with eloquent query builder. you can also use when() with laravel 6, laravel 7 and laravel 8 version: Simple When() Example:

When() Else Example:

Multiple When() Condition Example:


Laravel, Laravel 7, Laravel 8
Clear cache in Laravel

In this articale, you will learn how to clear caches in laravel application. In laravel application you can clear cache two types using artisan command and from browsers. I will mention few commands you can use to clear various types of cache like config cache, view cache, route cache and application cache from your laravel application. If you want to clear cache using commnad then open your terminal and go to the laravel application’s folder and execute below commands: Clear Application Cache To clear laravel application cache, run the following artisan command:

Clear Route Cache To clear route cache of your Laravel application run the following artisan command:

Clear Configuration Cache To clear the config cache of your laravel application, run the following artisan command:

Clear Compiled Views Cache To clear the view cache of your laravel application which are basically compiled view files, run the following

Laravel, Laravel 7, Laravel 8

In this article I will be explain “how to generate qr code in laravel”, In this article we will implements qr code in laravel 8. if you want to emplement qr code in your application then you are right place. simplesoftwareio/simple-qrcode simple-qrcode is package for generate qr code in laravel application. simple-qrcode provide to send sms and email with generated qr code. you can create qr code for geo, phoneNumber, birthdate using simple qrcode package. For that we require to install simple-qrcode package for qr code generator in application, So we just need to run below command in terminal.

After that open config/app.php file and add service provider and aliase.

Next we need to create route for testing qr-code

Now create a blade file to display the qr code, so let’s create blade file as like bellow code:


Laravel, Laravel 7, Laravel 8

When we are working on any projects then many times we need to get last executed query, If you are working on laravel framework and use laravel query builder And want to get last executed mysql query from laravel. Then you have to first enable query log that way it can be store query log. At last getQueryLog() through you can get last executed query. I give you example of how to get last executed mysql query. you can use example as following example.



In this post, I am going to explain How to remove foreign key constraint and database column that hosts a foreign key relationship, and we add wrong column with foreign key constraint on table. here, we will remove foreign key constraint using migration in laravel 6, laravel 7 and laravel 8. We can’t remove directly using dropColumn() if column applied foreign key constraint, So we should drop foreign key constraint of that column using dropForeign() and then we can delete column using dropColumn(). You can see as bellw migration, first i added migration with wrong column then other migration for remove that column. Wrong Column Migration:

Drop Column Migration: