๐Ÿ‹๏ธ
Lift for Laravel
View on GitHub
  • ๐Ÿ‹๏ธLift for Laravel
  • ๐Ÿš€Getting Started
    • Installation
    • Changelog
  • ๐Ÿ› ๏ธAttributes
    • Cast
    • Column
    • Config
    • DB
    • Events
    • Fillable
    • Hidden
    • Ignore Properties
    • Immutable
    • Primary Key
    • Relationships
    • Validation
    • Watch
  • ๐ŸงชMethods
    • castAndCreate
    • castAndFill
    • castAndSet
    • castAndUpdate
    • createValidationMessages
    • createValidationRules
    • customColumns
    • defaultValues
    • immutableProperties
    • updateValidationMessages
    • updateValidationRules
    • validationMessages
    • validationRules
    • watchedProperties
  • ๐Ÿค–Commands
    • lift:migration
Powered by GitBook
On this page

Was this helpful?

  1. Attributes

Ignore Properties

By default, when using the Lift trait, the model will ignore some public properties, that are "internal" properties, by being handled by Lift.

If you want to add additional properties to be ignored, you can use the IgnoreProperties attribute:

use Illuminate\Database\Eloquent\Model;
use WendellAdriel\Lift\Attributes\Fillable;
use WendellAdriel\Lift\Attributes\IgnoreProperties;
use WendellAdriel\Lift\Attributes\PrimaryKey;
use WendellAdriel\Lift\Attributes\Rules;
use WendellAdriel\Lift\Lift;

#[IgnoreProperties('hash', 'hash2')]
final class Product extends Model
{
    use Lift;

    #[PrimaryKey]
    public int $custom_id;

    #[Rules(['required', 'string'], ['required' => 'The Product name can not be empty'])]
    #[Fillable]
    public string $name;

    public string $hash;

    public string $hash2;
}
PreviousHiddenNextImmutable

Last updated 1 year ago

Was this helpful?

๐Ÿ› ๏ธ