Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Renaming DB Table and Eloquent Model with TDD

Premium
9:54

Comments & Discussion

HN
Huy Nguyen ✓ Link copied!

Hi, regarding all the gate permissions of product which were defined in the seeder file, according to laravel doc, these permission have to be defined in boot method of the service provider but when I check the source code in the repo. I don't see where these ones were defined.

For example: In the App\Http\Controllers\Admin\ProductsController, action index, product_access permission

  public function index()
    {
        abort_if(Gate::denies('product_access'), Response::HTTP_FORBIDDEN, '403 Forbidden');

        $products = Product::with(['user'])->get();

        return view('admin.products.index', compact('products'));
    }

I wonder where you define the logic of 'product_access' gate permission in the code? Thank you

PK
Povilas Korop ✓ Link copied!

In this project, pemissions are seeded into the database, and then transformed into the Gates with Middleware: source - this is code from our QuickAdminPanel.

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.