takshak / adash-shop
shop extension for adash admin panel
Requires
- barryvdh/laravel-snappy: ^1.0
- jenssegers/agent: ^2.6
- mpyw/compoships-eager-limit: ^1.0
- takshak/adash: ^8.0
- takshak/adash-reviews: ^1.3
README
This package is a part of Adash ecosystem. It is a shop implementation for Adash admin panel. It provides a simple and easy way to manage products, orders, customers and other related entities. It also comes with few inbuilt components that can be used to create a simple shop website.
Installation
composer require takshak/adash-shop
php artisan migrate
php artisan ashop:seed
Add argument 'fresh' (php artisan ashop:seed fresh
) if you are seeding the first time. It will publish the seeders first and then see the database
Add AshopUserTrait
to User model:
use Takshak\Ashop\Traits\AshopUserTrait;
class User extends Authenticatable implements MustVerifyEmail
{
use AshopUserTrait;
...
}
Publish assets php artisan vendor:publish --tag=ashop-assets
Publishable Files
php artisan vendor:publish --tag=ashop-config
php artisan vendor:publish --tag=ashop-views
php artisan vendor:publish --tag=ashop-assets
php artisan vendor:publish --tag=ashop-seeders
In-built components
-
ashop-ashop:admin-sidebar-links
This component is designed to render a specific view that contains the admin sidebar links.
-
ashop-ashop:inner-nav
This component create a inner (in page) navigation in admin panel. This accepts 2 arguments:
-
title (string) : display the title or the name of the navigation
-
links (array) : this will construct the navigation links. It contains permission (to check the permission), text (displayed text of nav item) and url (actual url of navigation).
For Example
:links="[ [ 'permission' => 'products_details', 'text' => 'Product Detail', 'url' => 'route('admin.product.details')' ], [ 'permission' => 'products_images', 'text' => 'Product Images', 'url' => 'route('admin.product.images')' ] ]"
-
-
ashop-ashop:product-nav
This component is made on the top of
ashop-ashop:inner-nav
where you need to pass the product's modal instance and this will create the product inner navigation for you. eg.<x-ashop-ashop:product-nav :product="$product" />
-
ashop-ashop:product-card
This component will create a card layout of the product for displaying, it accepts only one argument product.
<x-ashop-ashop:product-card :product="$product" />
-
ashop-ashop:product-list-item
This component is similar to ashop-ashop:product-card, it display the product item as a list item
-
ashop-ashop:shop-sidebar
This will create a sidebar on products listing page at the front end to show the categories and filter options like color, size, pattern etc. in sidebar to let user filter the products. It can accept 2 arguments:
-
category (optional): you can pass a category model to make that category as active category in the sidebar and all the filterable options / attributes will be shown in the sidebar which are associated to this category only if filterAttributes argument is not passed saperately.
If there is any category in query parameter (in current url), it will take that category as primary category.
-
filterAttributes (array: optional): If you already got the filterable attributes you can pass here which will save a couple of queries
-
-
ashop-ashop:shop-header
This will have a header on product listing page which will contain search with categories, ordering and listing layout.
-
ashop-ashop:products-group
This will show a group of product in any section of the page, where you want to show latest, oldest, products of any category etc. You will have multiple options which might be changed according to out requirement that which products we need to show.
-
title (string: optional): Show the title / heading for the group
-
subtitle (string: optional): Show the subtitle in smaller font
-
heading (string|html: optional): If we want show some other content in the header
-
buttons (array: optional): show some buttons / links in the heading like: show more or any other button. For Example.
:buttons="[ [ 'text' => 'See More', 'url' => route('shop.products', ['order_by' => 'latest']) ] ]"
-
type (string: optional): you will pass featured in this argument which will get you only featured products.
-
order (string: optional): we can set the order of the product listing, we can pass latest, oldest or rand. (default: 'latest')
-
ids (array: optional): if we want to list a group of some specific products, we will pass the array or products IDs, so that this will only show those products.
-
categories (array: optional): if we want to show the products from some specific categories, we will pass the list categories in an array. This array can contain categories id, name or slug.
-
products (collection: options): if we got the collection of products we can pass here the products and it will list those product. This will not apply other arguments like, type, categories, ids etc.
-
limit (number: optional): this will limit the products listing (default: 10)
-
container (bool: options): if we want to render this section in a container or not. (default: true)
-
columns (string: optional): to decide how many columns will be rendered in this section, it will accept bootstrap column classes. (default: 'row-cols-2 row-cols-md-3 row-cols-lg-4 row-cols-xl-5')
-
-
ashop-ashop:categories-group
This will show the list of categories in a section. we might use this to show latest categories, popular categories, featured categories etc. you can customize this components with these parameters:
-
title (string: optional): Show the title / heading for the group
-
subtitle (string: optional): Show the subtitle in smaller font
-
buttons (array: optional): show some buttons / links in the heading like: show more or any other button. For Example.
:buttons="[ [ 'text' => 'See More', 'url' => route('shop.products', ['order_by' => 'latest']) ] ]"
-
parent (bool: optional): this will allow you to show only parent categories. (default: true)
-
type (string: optional): you will pass featured or is_top in this.
-
order (string: optional): we can set the order of the items listing, we can pass latest, oldest or rand. _(default: 'latest')
-
ids (array: optional): if we want to list a group of some specific items, we will pass the array or categories IDs.
-
category_id (int: options): this will be useful when you want to show the child categories of any specific category when parent argument is set to false
-
limit (number: optional): this will limit the items listing (default: 10)
-
columns (string: optional): to decide how many columns will be rendered in this section, it will accept bootstrap column classes. (default: 'row-cols-2 row-cols-md-3 row-cols-lg-4 row-cols-xl-5')
-
-
ashop-ashop:brands-group
This component will be useful when we want to so the list to brands in a section. this will also contains the arguments similar to ashop-ashop:categories-group component.
- title (string: optional)
- subtitle (string: optional)
- buttons (string: optional)
- order (string: optional) (default: latest)
- ids (array: optional): will accept array of brands IDs
- categories (array: optional): we will pass the list categories in an array. This array can contain categories id, name or slug
- limit (int: options) (default: 10)
- columns (string: optional) (default: 'row-cols-2 row-cols-sm-3 row-cols-md-4 row-cols-lg-5 row-cols-xl-6')
-
ashop-ashop:user-account
This will render the user dashboard layout with sidebar menu. We can pass the page title in title argument. This is not suppose to be a self closing component so you can pass the inner page content inside this. For example:
<x-ashop-ashop:user-account title="My Orders"> {{-- orders page html content --}} </x-ashop-ashop:user-account>
-
ashop-ashop:user-bottom-nav
This will render main user pages navigation with icons.
-
ashop-ashop:products-viewed-history
This will show a section to show already viewed products list. this can contains some augments for tweaking.
- title (string: optional)
- subtitle (string: optional)
- limit (int: options) (default: 25)
-
ashop-ashop:mail-layout This can be used when creating a emil to send to users.