sleeping-owl / admin

Administrative interface builder for Laravel
http://sleeping-owl.github.io/
MIT License
503 stars 260 forks source link

Trouble with show data from own model #356

Open tomastovt opened 7 years ago

tomastovt commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

@tomastovt please use https://github.com/LaravelRUS/SleepingOwlAdmin