Pass breads to my customer

Posted In Wave
  • carlos-bz 1 year ago
    Hi Tony, i´m very happy that you get back.
    I need to show breads to a user (customer) frontend, i tried to extend voyager::master, but this show also the Admin menú, and those user Shuldn´t see this. If i just extend layouts.app and then copy/paste the code of bread that you show in Overriding views (in laravelvoyager . com/academy/views/) i have several errors related to DataType.
    And also i need to the data of the bread its conected with the API, in other words, i woud like to user have a two ways to consume the service, by API and manualy in front end, of course, this could be useful to show graph and reports of use.
    
    Thanks a lot!!
    
    
    

    Hi Tony, i´m very happy that you get back. I need to show breads to a user (customer) frontend, i tried to extend voyager::master, but this show also the Admin menú, and those user Shuldn´t see this. If i just extend layouts.app and then copy/paste the code of bread that you show in Overriding views (in laravelvoyager . com/academy/views/) i have several errors related to DataType. And also i need to the data of the bread its conected with the API, in other words, i woud like to user have a two ways to consume the service, by API and manualy in front end, of course, this could be useful to show graph and reports of use.

    Thanks a lot!!

  • tnylea 1 year ago
    Hey Carlos,
    
    So, you essentially want the users who are not logged in to be able to browse content, correct? I'm not sure if you need to extend the voyager::master, instead create your own. Can you let me know an example of the data you are trying to allow your users to view? Once I have this I might be able to send you over some code that would better fit your needs :)
    
    Thanks!

    Hey Carlos,

    So, you essentially want the users who are not logged in to be able to browse content, correct? I'm not sure if you need to extend the voyager::master, instead create your own. Can you let me know an example of the data you are trying to allow your users to view? Once I have this I might be able to send you over some code that would better fit your needs :)

    Thanks!

  • carlos-bz 1 year ago
    Hi Tony,
    I need to only logged user to be able to browser even only one kind of role. 
    I want to make platform of  shipment and fullfillment sevices, and i want to receive orders by api and by the website, so if a customer "x" have the role "Y" have the capacity to order by API and website, if role "Z" only website. 
    So, thats it´s why i need to show the bread that i can create and manage in backend to the user frontend (logged and with some paided plan). Once logged, i would like to show a dashboard with statistics and  a menu to link:
    - a browse of order history (of course disable to delete) but with the capacity of sort and print or export.
    - a bread to create a new orders.
    - a bread with they product.
    
    
    I hope I have been more clear.
    thanks for your help
    

    Hi Tony, I need to only logged user to be able to browser even only one kind of role. I want to make platform of shipment and fullfillment sevices, and i want to receive orders by api and by the website, so if a customer "x" have the role "Y" have the capacity to order by API and website, if role "Z" only website. So, thats it´s why i need to show the bread that i can create and manage in backend to the user frontend (logged and with some paided plan). Once logged, i would like to show a dashboard with statistics and a menu to link:

    • a browse of order history (of course disable to delete) but with the capacity of sort and print or export.
    • a bread to create a new orders.
    • a bread with they product.

    I hope I have been more clear. thanks for your help

  • tnylea 1 year ago
    Hey Carlos,
    
    It looks like you are going to want to create some custom rules as to whether a user with a specific role can view orders by website or the API. Can you give me a list of some of your role names? Say for instance you created a role called `website_only`,
    
    Inside of your code you would need to specify whether the user has this role or not and only allow them access to the website as opposed to the API version.
    
    here is a quick example:
    
    ```
    public function view_orders_api(){
        if( Auth::user()->role->name == 'website_only' ){
    		    // redirect back to the homepage and show permission message
    				return redirect('/');
    		}
    }
    ```
    
    In the function above you are saying that users with `website_only` role will not be allowed access to that function and you'll be responsible for showing them a message :)
    
    You may want to look through the Voyager documentation to learn more about this.
    
    I would recommend checking out the [Permission & Roles](https://docs.laravelvoyager.com/core-concepts/roles-and-permissions) section, and the [Setting up Bread](https://docs.laravelvoyager.com/core-concepts/bread-builder) section.
    
    Hope that helps. Thanks!

    Hey Carlos,

    It looks like you are going to want to create some custom rules as to whether a user with a specific role can view orders by website or the API. Can you give me a list of some of your role names? Say for instance you created a role called website_only,

    Inside of your code you would need to specify whether the user has this role or not and only allow them access to the website as opposed to the API version.

    here is a quick example:

    public function view_orders_api(){
        if( Auth::user()->role->name == 'website_only' ){
    		    // redirect back to the homepage and show permission message
    				return redirect('/');
    		}
    }
    

    In the function above you are saying that users with website_only role will not be allowed access to that function and you'll be responsible for showing them a message :)

    You may want to look through the Voyager documentation to learn more about this.

    I would recommend checking out the Permission & Roles section, and the Setting up Bread section.

    Hope that helps. Thanks!

  • carlos-bz 1 year ago
    Hi Tony, Thanks for That. As you say, the permission could be bounded in the code, but i think this  could be done with the Role  permission from voyager/wave, as the same time, this role bounded to a plan (also from voyager/wave).
    The name's for roles it´s a minor detail, could be: 
    -starter (means only web access),
    -premium (means web access and limited consumption of the api for example. 25 items created by a month, if they want to create 26 or + need to pay a fee by each aditional),
    -Golden (means web access and limited consumption of the api for example. 50 items created by a month, if they want to create 21 or + need to pay a fee by each aditional),
    -Platinum (website and ilimeted consumption of the api).
    
    But still i can´t understend  how to show the BREAD to a user Frontend like this:
    
    https://drive.google.com/open?id=1TTF1eCJmR16atqXCAaJaxS8IrWBEoHS2
    
    Thanks For your help
    
    
    
    

    Hi Tony, Thanks for That. As you say, the permission could be bounded in the code, but i think this could be done with the Role permission from voyager/wave, as the same time, this role bounded to a plan (also from voyager/wave). The name's for roles it´s a minor detail, could be: -starter (means only web access), -premium (means web access and limited consumption of the api for example. 25 items created by a month, if they want to create 26 or + need to pay a fee by each aditional), -Golden (means web access and limited consumption of the api for example. 50 items created by a month, if they want to create 21 or + need to pay a fee by each aditional), -Platinum (website and ilimeted consumption of the api).

    But still i can´t understend how to show the BREAD to a user Frontend like this:

    https://drive.google.com/open?id=1TTF1eCJmR16atqXCAaJaxS8IrWBEoHS2

    Thanks For your help

Please login or signup to leave a response.

Login

or Sign Up

Sign Up

or Login
×
Want to create your own SAAS?

I can teach you to create your own Software as a Service. Click here to learn more!

Visit SAAS Adventure!