$user = new User(); $user->username = "john"; $user->password = "password"; $user->email = "john@example.com"; $user->role = "admin"; $user->save();
$user = User::findOne(['id' => 1]); $user->username = "jane"; $user->save();
$user = User::findOne(['username' => 'john']); echo $user->email;This common.model User className is often used in PHP frameworks such as Yii, Laravel, and CodeIgniter, as well as third-party libraries such as Doctrine and Eloquent. The package library for this model would depend on the specific framework or library being used.