Menu
About LCS
Eloquent ORM
It is object relational mapper that provides smooth interaction with database.
How to use whereHas to retrieve rows based on existence of relationship
whereHas() method is used to add further query constraints on top of has() method. Suppose, there is user hasMany relationship...
Topic:
Eloquent Builder
3 years ago
Using withAggregates in Eloquent way
Suppose Post hasMany Rating and there is a field rating in ratings table. For this following snippet can be used...
Topic:
Eloquent Builder
3 years ago
Selecting fields inside eager loading method "with"
Suppose there is a relation Post belongsTo User. If we are retrieving posts with associated user relation, we can use...
Topic:
Eloquent Builder
3 years ago
Working with different table name for a model
If we need to work with a model with different table name which is usually needed for old projects where...
Topic:
Configurations
3 years ago
changing auto incremeneting field names
Like different table names it is also usually needed for old projects where incrementing field names for a table could...
Topic:
Configurations
3 years ago
Changing pagination setup mentioning item amount per page from model
By default it is setup to 15 in laravel but you can do that from model as well. You do...
Topic:
Configurations
3 years ago
Changing timestamp field names
Suppose there are timestamps fields created and modified in table then if we were to use that in project we...
Topic:
Configurations
3 years ago
Adding custom date fields for processing with Carbon object
Sometimes besides created_at and updated_at we may need another custom date fields which can be needed to process with Carbon...
Topic:
Configurations
3 years ago
Setting up custom date format
By default it is defined as 'Y-m-d H:i:s' and in order to use different date format we can use following...
Topic:
Configurations
3 years ago
Using fillable or guarded
If you have Post Model with title and description you can setup these fields with fillable or gurded in order...
Topic:
Configurations
3 years ago
‹
1
2
3
4
5
›