Comments (3)
i get the value of floor level by defining custom column
but it is possible if i want to access floor level through room.floor.level
i think this is simpler
public static function laratablesCustomLevel($user)
{
return $user->room->floor->level;
}
columns: [
{ name: 'id' },
{ name: 'name' },
{ name: 'email' },
{ name: 'action', orderable: false, searchable: false },
{ name: 'room.name', orderable: false },
{ name: 'level' }
]
from laratables.
You're right @zendzo
Nested relationships aren't supported yet.
You have used the custom column the right way but you should also tell the query to eager load data to prevent n+1 issue.
/**
* Specify additional conditions for the query, if any.
*
* @param \Illuminate\Database\Eloquent\Builder
* @param \Illuminate\Database\Eloquent\Builder
*/
public static function laratablesQueryConditions($query)
{
return $query->with([ 'room.floor.level' ]);
}
from laratables.
As this isn't a common use case, I would prefer not to add support for now. Have already added the note in the readme.
from laratables.
Related Issues (20)
- Non-static method App\Model\MyModel:laratablesRowData() HOT 1
- Undefined method HOT 4
- Is there a way to use custom data (fetched by another http api call from eg. stripe) in backend as the table data? HOT 1
- Getting ErrorException on passing parameter to custom controller via AJAX HOT 1
- Error Order Relational Column HOT 1
- Passe Custom Data Seach HOT 17
- Laravel 11 HOT 2
- pagination not work when use group by HOT 1
- Ordering on custom field HOT 1
- Is the ID column hard-coded? HOT 3
- integration violation 'id' laratablesQueryConditions HOT 1
- One to One relationship Data returns N/A HOT 3
- Method laratablesQueryConditions field returning ambiguous mysql error on join columns HOT 1
- buttons with javascript prevent default not working HOT 2
- Laratable Class accepting parameters HOT 6
- Many2One Relation HOT 1
- No way to whitelist columns server-side HOT 2
- Add group by feature HOT 6
- does this support complex multiple row headers? HOT 1
- Incompatible with PHP 8 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laratables.