thedevdojo / voyager

Voyager - The Missing Laravel Admin
https://voyager.devdojo.com
MIT License
11.77k stars 2.67k forks source link

How to passing data from Voyager to the front-end page or a REST API interface? #159

Closed vanloc0301 closed 7 years ago

vanloc0301 commented 7 years ago

Edited:

I come from Codeigniter; I have a time with Voyager. That cool.

Typically, I create a front-end base on PSD file.

When user CRUD in Voyager success. I want to show this data on front-end page.

But I can't find any document to pass data from Voyager to front-end page. e?

Can you create a demo in your repository to do that?

Thanks.

vanloc0301 commented 7 years ago

My question seem not unclear? I don't receive any comment.

marktopper commented 7 years ago

You need to use the models for that.

You can learn about how to use models here.

Take the Page model for an example, post the body from the page that matches a specific slug.

use TCG\Voyager\Models\Page;

// get the page
$slug = 'my-page';
$page = Page::where('slug', $slug)
    ->where('status', 'ACTIVE')
    ->first();

// if not found, throw 404
if (is_null($page)) {
    abort(404);
}

// if page exists, output body
print $page->body;
vanloc0301 commented 7 years ago

Thanks, @marktopper . I found a bug of the voyage like when I interactive with GUI like Click in Post or CRUD rows in Table Post. Seem UI of Voyager is broken.

It usually happens. I must refresh the page to see.

It lost any element of a page.

marktopper commented 7 years ago

That is a separate error, however I believe this have been fixed in a pull request already, however the pull requests haven't been merged for 4 days. But hopefully it will be soon.

vanloc0301 commented 7 years ago

Thanks, @marktopper . I tried to your link provider.

But you have any example in the real project.

Do you share a file in gist?

marktopper commented 7 years ago

What do you mean @vanloc0301?

marktopper commented 7 years ago

Closed due to inactivity.

github-actions[bot] commented 4 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.