Tag: Model

image

How does the $appends property work in Eloquent Models?

In Laravel, the appends property allows you to add virtual attributes to your model that aren't actually stored in the database. This is useful for adding calculated or derived attributes to your models.

Tim Wassenburg

By Tim Wassenburg

PHP/Laravel Developer

Date

02 Apr, 2023

image

Laravel Guarded vs Fillable: Choosing the Right Approach

Laravel's guarded and fillable properties in models handle mass assignment security differently. guarded specifies attributes to exclude, while fillable specifies attributes to allow. Choose based on security and maintainability needs.

Tim Wassenburg

By Tim Wassenburg

PHP/Laravel Developer

Date

17 May, 2023