PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Question By
Solved

Support for settings in subscription plans

Solved
rs1234

Dec 21st, 2020 06:06 AM

As the course mentions in "Subscription Plans" with the example of limiting features for each plan how is this possible with Wave?

The video mentions in the example "1 Project Access, 1 User per Project".

Since this is exactly what I would like to build I do not see support for this in any way.

I would like to have some sort of settings that I can manage per plan. And then check these with the "can" method in blade.

Can someone assist how to modify the code?

bobbyiliev

Dec 23rd, 2020 01:01 AM

Best Answer

Hi there,

You can use the User Roles to limit the access for your users from executing specific CRUD actions.

However for additional limitations, you would need to add some custom logic as well.

For example if you have a Model called Projects, you could add an if statement to check which Plan the user is assigned to and allow them to add more projets or not.

To check the current plan for a specific user you could use the following:

auth()->user()->role->name

Also if you wanted to check if a user can create projects you could use the following statement:

@if (auth()->user()->can('create', App\Project))
    // can create a project
@else
    // can not create a project
@endif

You could extend that if statement and check how many projects the user currently has and if they are more than the allowed don't let them create more projects.

Regards, Bobby