Changes model hidden property to use the hidden attribute
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Attributes\Hidden;
+#[Hidden(['password'])]
class User extends Model
{
- protected $hidden = [
- 'password',
- ];
}
Configure your rector.php:
<?php
use RectorLaravel\Rector\Class_\HiddenPropertyToHiddenAttributeRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
HiddenPropertyToHiddenAttributeRector::class,
]);