error while converting sql to eloquent query
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()')