In this article, We will explain to you how to use the Union query in laravel(laravel eloquent Union query example). here we will give you a simple example of laravel eloquent Union query. 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.