error while converting sql to eloquent query I have converted an sql query to eloquent like below:

$roomtypes = DB::select(`rt.id`,`rt.type`,`rt.total_no_of_rooms`)
    -&gt;addSelect(DB::raw(`SUM(r.no_of_rooms) as reserved rooms`))
    -&gt;selectSub(`rt.total_no_of_rooms`, `rooms available`)
    -&gt;selectSub(`-`, `rooms available`)
    -&gt;selectSub(`SUM`, `rooms available`)
    -&gt;from(`Roomtypes as rt`)
    -&gt;join(`Reservations as r`, function($join) {
        $join-&gt;on(`r.roomtype_id`, `=`, `rt.id`)
            -&gt;on(`$check_in`, `&gt;=`, `r.check_in`)
            -&gt;on(`$check_out`, `&lt;=`, `r.check_out`);
        })
    -&gt;groupBy(`rt.id`)
    -&gt;groupBy(`rt.type`)
    -&gt;groupBy(`rt.total_no_of_rooms`)
    -&gt;get();


but I am getting an error


  "Argument 1 passed to Illuminate\Database\Connection::prepareBindings() must be of the type array, null given, called in "


Please, could anyone help ?
I have found the an alternate for this. I created a stored procedure in laravel using migrations 



use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateProcedure extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::unprepared('
            CREATE PROCEDURE fetch_all_users()
            BEGIN
                select * from users;
            END'
        );
    }

/**
 * Reverse the migrations.
 *
 * @return void
 */
public function down()
{
    DB::unprepared('DROP PROCEDURE IF EXISTS fetch_all_users');
}


}

Then i called it in the code:


  DB::select('call fetch_all_users()')