In Laravel the set{Attribute}Attribute accessor methods are used to set new attributes in a model. For example, we do use $appends property to create our popular “full_name” attribute to combine “first_name” and “last_name” attributes. Following the syntax to define $appends…
Tag: model
Contain and selected fields of model with User _attachAttributes
I am in a Task model. I build following options to load the Task and associated User model data.
How to use multiple validation rule sets per model in cakephp
As default we have single var $validate rule set in the model class which is triggered on each save() method call while saving form data. This is quite logical and sufficient for single form fields to validate but what if…
How to apply search filters in cakephp ajax pagination
Sometimes we need to filter records via custom query while using ajax pagination in a cakephp application. An easy way to achieve this is to store query in a session varibale and to check it whenever an ajax call is…
Multiple validation rules for a single field in cakephp
Cakephp framework provides a strong model validation mechanism. Here is the quick overview of multiple validation rules applied to a single field. Let say we are using “User.password” and “User.password2” fields to accept/confirm password while registering to a site. We…