admin icon indicating copy to clipboard operation
admin copied to clipboard

Trouble with show data from own model

Open tomastovt opened this issue 8 years ago • 2 comments

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 avatar Jan 16 '17 14:01 tomastovt

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; })

tomastovt avatar Jan 25 '17 06:01 tomastovt

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

butschster avatar Feb 13 '17 21:02 butschster