Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble with show data from own model #356

Open
tomastovt opened this issue Jan 16, 2017 · 2 comments
Open

Trouble with show data from own model #356

tomastovt opened this issue Jan 16, 2017 · 2 comments

Comments

@tomastovt
Copy link

tomastovt commented Jan 16, 2017

Hi, there is an element AdminColumn::text. If I use it with relationships with 2 models - everything is OK. But I have One model: Categories with fields id,name,alias,parent_id,created_at,updated_at and I want to show parent category name on view. Can anybody help me in what direction to look for solution. Thanks

@tomastovt tomastovt changed the title Trouble with List data in own model Trouble with show data from own model Jan 16, 2017
@tomastovt
Copy link
Author

tomastovt commented Jan 25, 2017

I get solution with AdminColumn's custom method here is my code:
AdminColumn::custom()->setLabel('Parent Category')->setCallback(function($model){ $oParentCategory = Category::where('parent_id', $model->parent_id)->first(); return $oParentCategory->name; })

@butschster
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants