Courses

10+ Laravel Refactoring Examples

Renaming DB Table and Eloquent Model with TDD

Previous: Long Class Method - Into Smaller Methods
avatar

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

avatar

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

avatar
You can use Markdown
avatar
You can use Markdown