From the https://flixtechs.co.zw/posts/laravel-ecommerce-tutorial-part-3-managing-roles-and-permissions we laid all the foundational features of an ecommerce store from manage users to role based access control. Oftentimes these categories are nested, for example Electronics → Laptops → Gaming Laptops or something like that.

* * @return array */ public function definition(): array { return [ 'name' => $this->faker->unique()->word, 'parent_id' => $this->faker->randomElement([ Category::factory(), null, ]), 'description' => $this->faker->sentence, ]; }}

* * @param Category $category * @return Renderable */ public function edit(Category $category): Renderable { $categories = Category::all(); return view('admin.categories.edit', [ 'category' => $category, 'categories' => $categories, ]); }

* * @return Renderable */ public function index(): Renderable { $categories = QueryBuilder::for(Category::class) ->allowedFilters([AllowedFilter::scope('search', 'whereScout')]) ->with('parent') ->paginate(10) ->appends(request()->query()); return view('admin.categories.index', [ 'categories' => $categories, ]); }
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners