thedevdojo / voyager

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

[discussion] how to show content in menu in front-end but not backend? #421

Closed akpotter closed 7 years ago

akpotter commented 7 years ago

Description:

I tried use php artisan make:auth and insert \<?=Menu::display('main', 'bootstrap') ?> in front-end views\layouts\app.blade.php Add BREAD to table "products" and use MenuBuilder

And the main menu can display in front-end successfully.

But when click button in menu, it will turn into backend display /admin/products Is there some methods which voyager design for us to display the table in the front-end? Or what should I do for customizing this?

Thanks a lot.

Steps To Reproduce:

marktopper commented 7 years ago

If I understand you correctly, you wish to add a menu item with the link to view all your products.

Then what I would do is to make a menu item with a link to /products. Then I would make a route for that like this:

Route::get('/products', function () {
    $products = App\Products::all();
    return view('products.list', [
        'products' => $products,
    ]);
});

Then you can show your products there to the front-end users.

NOTE: It's on my todo to make some helpers and guides for using Voyager on the front-end

akpotter commented 7 years ago

Sorry I do not mention it clearly. My question is : Can I use the BREAD function in the frontend page (http://localhost/home/ ) ? Which do not need admin permission like these " X Admin X Browse Admin X Browse Database X Browse Media X Browse Settings "

just need these permission and URL not in "localhost/admin/product" " V Product V Browse Product V Read Product V Edit Product V Add Product V Delete Product "

Thanks a lot.

handiwijoyo commented 7 years ago

You can check the user permission using Voyager::can('browse_product')

fletch3555 commented 7 years ago

@akpotter, Voyager is intended to be an Admin tool, not frontend functionality. You can build Menus and display them in the front-end, but the BREAD functionality is specific to Voyager. If you need front-end functionality to let end-users create/edit things, then you will need to create forms and use the model that Voyager created.

Apologies if I misunderstood your question. If that's the case, please clarify and let me know.

akpotter commented 7 years ago

Got it! Nice job! I will try do front-end functionality by myself. Thanks for all your contributions. And there is a remote code execution vulnerability in Voyager right now. Later someday I will create an issue for it.

marktopper commented 7 years ago

@akpotter, please send me a email with the security vulnerability please.

mark@ulties.com

DjKhireddine commented 6 years ago

Hi, Laravel 5.5 / Voyager 1.0

Can we hide some views to use who are not admin? for exemple some pages or products which are not published and want to let offline.

Thanks

marktopper commented 6 years ago

Hey @decomstore Please create your own issue for this, since this have been closed for long time. NOTE: You can read how to do such thing using the policies here: https://webman.io/blog/post/using-policies-in-laravel-voyager

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.