Hi @mirsahib !
According to documentation (https://laravel.com/docs/7.x/database#running-queries):
The select method will always return an array of results. Each result within the array will be a PHP stdClass object, allowing you to access the values of the results:
So you should access the id using $id->id instead.
Anyway, why are you using DB::select instead of Eloquent Model queries?
In this example you could simply do something like this (assuming you have a Tenant model):
$tenants = Tenant::where('status', 1)->get();
foreach($tenants as $tenant){
$payment = new Payment;
$payment->tenant_id = $tenant->id;
$payment->pay_month = $request->month;
$payment->pay_year = $request->year;
$payment->save();
}