Laravel-Backpack/PageManager

how to get fake column value

gumpon opened this issue · 1 comments

Bug report

What I did:

$pages = Page::orderBy('lft', 'asc')->get();  
foreach ($pages as $page)	{
            dd($page->meta_title);
        }

What I expected to happen:

how to get meta_title in blade view

What happened:

get fake value

What I've already tried to fix it:

Backpack, Laravel, PHP, DB version:

L5.8
PHP7.2

@gumpon to get the meta_title on the front-end you can do:

$meta_title = Page::find(4)->withFakes()->meta_title;
// notice withFakes()

Or

// if you're running PageManager 2.0.1 or higher
$meta_title = Page::find(4)->extras['meta_title'];

The example front-end in the docs includes a withFakes() call, you must have missed that.

Cheers!