Jorge Iraira
Jorge Iraira

Reputation: 61

laravel-voyager custom views for role

Laravel Version: 5.26.27
Voyager Version: 1.1.3
PHP Version: 7.2.1
Database Driver & Version: MySQL 5.6.38
Description:

I'm new to Voyager but have already managed to create tables, populate them and configure their access privileges for BREAD.

But I need one option to see in the posts the custom roles can view just himself post, I see one option

@foreach($dataTypeContent->where('author_id','=', Auth::user()->id) as $data)

But this code modifies all views because is in the view. I need some more generic in the model

Is this possible with Voyager or it calls for custom code? Thanks in advance!

Upvotes: 5

Views: 8524

Answers (1)

WhyAyala
WhyAyala

Reputation: 675

Your question is a little confusing to read, but it sounds like you're asking if it's possible to override Voyager views or add custom views and the answer is, yes you can.

They have a video here: https://laravelvoyager.com/academy/views/

and written documentation here: https://voyager.readme.io/docs/overriding-views

The short of it is, create a directory resources/views/vendor/voyager/slug-name where slug-name is the slug for the corresponding table view you want to override. Put an edit-add.blade.php file in that folder along with a browse.blade.php file. I would just copy Voyagers default view logic into those files and then modify them to suit your needs.

Upvotes: 2

Related Questions