In PHP, Eloquent.unguard is a method that is used in the Laravel framework's Eloquent ORM (Object-Relational Mapping). This method temporarily disables the mass assignment protection feature in Eloquent, allowing all attributes to be mass assignable without any restrictions. Mass assignment refers to the ability to set multiple attributes of a model at once, using an array or JSON object. By default, Eloquent guards against mass assignment vulnerabilities to prevent unauthorized or unintended changes to a model's attributes. However, there may be certain cases where unguarding is necessary, such as during seed data generation or when updating a large number of records. It is important to exercise caution when using Eloquent.unguard, as it can potentially expose security risks if not used properly.
PHP Eloquent::unguard - 30 examples found. These are the top rated real world PHP examples of Eloquent::unguard from package someline-starter extracted from open source projects. You can rate examples to help us improve the quality of examples.