Deprecated assign method in php 8.2
I reading the php 8.2 features and i found this part
'''
class User
{
public $name;
}
$user = new User();
$user->last_name = 'Doe'; // Deprecated notice
$user = new stdClass();
$user->last_name = 'Doe'; // Still allowed
'''
So we in laravel use this dynamic properties to assign the values , how we 'll use it now ?
I don't understand this:
$user = new stdClass(); $user->last_name = 'Doe';
Normally you get it from request. Can you give a reference where
$user = new User(); $user->last_name = 'Doe';
is deprecated
From Docs:
public function store(Request $request)
{
// Validate the request...
$flight = new Flight;
$flight->name = $request->name;
$flight->save();
}
Leave off the ().
It is only deprecated if you don't use __set(), which laravel does. It's a magic method to properly handle these. So there isn't a problem with models
Please or to participate in this conversation.