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