In this article, We will explain to you how to use the Union query in laravel. The laravel eloquent provides many types of eloquent methods. the Union method two queries combine and return the data.
So you can see below the following example.
$student_1 = DB::table('students')
$student_2 = DB::table('standards')
The unionAll method is also available and so same as the syntax of a union.