Parameterize value can use create view in mongo shell , is it possible use same scenario in using Laravel

I can use parameterize value in mongo shell command. is it possible create view and use parameterize value under the view. as an example need create view get data with limit base on percentageValue and need to assign percentageValue dynamically.

here is the code use in mongo shell. I can change percentageValue and get data according to that value. now I need create a view and use it . Also need to change percentageValue in my backend ( Laravel)

// Parameterize the percentage value as needed
let percentageValue = 10; // For example, for top 10%
db.getCollection('order_history').aggregate([
	// Unwind the invoice items
    { $unwind: { path: '$invoice_items' } },
	// Filter out the relevant invoice items
    {
        $match: {
            'invoice_items.type': 'payment',
            'invoice_items.status': 'success'
        }
    },
	// get amount out the relevant invoice items
	{
	  $addFields: {
		tot_amount_array: {
		  $map: {
			input: '$invoice_items',
			as: 'r',
			in: { $toInt: '$$r.amount' }
		  }
		}
	  }
	},
	{
	  $addFields: {
		tot_amount: { $last: '$tot_amount_array' }
	  }
	},
	// Group by s_id and calculate the total spent		
    {
        $group: {
            _id:  '$s_id',
            count: { $sum: 1 },
            total_spent: { $sum:  '$tot_amount' },
			s_id: { $first: '$s_id' },
        business_id: {
          $first: '$business_id'
        }
        }
    },
	// Sort the users by their total spending
    { $sort: { total_spent: -1 } },
	// Group all data and calculate the total count of users
    {
        $group: {
            _id: null,
            allData: { $push: "$$ROOT" },
            totalCount: { $sum: 1 }			
        }
    },
	// Calculate the limit based on the percentage value
    {
        $addFields: {
            limit: { $ceil: { $multiply: ["$totalCount", percentageValue / 100] } }
        }
    },
	// Slice the data based on the calculated limit
    {
        $project: {
            data: { $slice: ["$allData", "$limit"] }
        }
    },
	// Unwind the data for the final output
    { $unwind: { path: '$data' } },
	// Replace root to display the desired output format
    { $replaceRoot: { newRoot: "$data" } }
]);