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
Unsolved

Help please! Plan - product wave!

sto2t0

Dec 11th, 2022 03:56 PM

Greetings team devdojo! Please help me :)

I need to create a site with the ability to post news in different categories with different parameters. To do this, I improved the blog section and sharpened it for the right parameters. Made 2 different modules.

But there was a problem, I need to make it possible to view different categories of these modules in different ways depending on the tariff plan, while so that the site is not loaded with unnecessary requests. I made the blog module load only for authorized users.

1.Now it is necessary that out of 15 categories out of three tariffs, only 5 categories for the smallest tariff are loaded, and all posts in these categories, and all other posts with other categories are not available

2.How to make it so that for another module - for the smallest plan, only 30 posts were loaded, selected by me by id, the rest of the posts and categories were not available, but for larger ones everything was loaded perfectly.

I want to do this task as soon as possible, I really hope for help, thank you.

I tried in different ways, it was very incomprehensible to add permission through the admin panel. I want to do it through the controller, but I don't know how.

bobbyiliev

Dec 12th, 2022 12:22 AM

Hi there,

Indeed putting the logic in the controller sounds like it would work for your user case.

You could just check the role of the user in question and then return the records that you want. For example:

if (auth()->user()->role->name == 'Pro') {
    // return something
} else if (auth()->user()->role->name == 'Free') {
    // Do something else
} else if (auth()->user()->role->name == 'Admin') {
    // Do something else
} else {
    // Do something else
}

Hope that this helps!