Laraplug Shop is a flexible, extendable e-commerce module, built on top of AsgardCMS platform.
Integrated with the modules below
laraplug/product-module
laraplug/attribute-module
laraplug/cart-module
laraplug/order-module
laraplug/theme-module (Deprecated)
-
Install the package via composer:
composer require laraplug/shop
-
Execute migrations via AsgardCMS's module command:
php artisan module:migrate Attribute php artisan module:migrate Product php artisan module:migrate Cart php artisan module:migrate Order --seed php artisan module:migrate Shop --seed
-
Execute publish via AsgardCMS's module command:
php artisan module:publish Attribute php artisan module:publish Product php artisan module:publish Cart php artisan module:publish Order php artisan module:publish Shop
-
Done!
To create your own Book
Product Eloquent model on BookStore
module, just extend the \Modules\Product\Entities\Product
model like this:
use Modules\Product\Entities\Product;
class Book extends Product
{
// Override entityNamespace to identify your Model on database
protected static $entityNamespace = 'bookstore/book';
// Override this method to convert Namespace into Human-Readable name
public function getEntityName()
{
return trans('bookstore::books.title.books');
}
}
Add $systemAttributes
to utilize laraplug/attribute-module on code-level like this:
use Modules\Product\Entities\Product;
class Book extends Product
{
...
// Set systemAttributes to define EAV attributes
protected $systemAttributes = [
'isbn' => [
'type' => 'input'
],
'media' => [
'type' => 'checkbox',
'options' => [
'audio-cd',
'audio-book',
'e-book',
]
]
];
}
type : String of input type (list below)
input
: input[type=text]textarea
: teaxarearadio
: input[type=radio]checkbox
: input[type=checkbox]select
: selectmultiselect
: select[multiple]
options : Array of option keys
has_translatable_values : boolean
You can register your Entity using ProductManager
like this:
use Modules\Product\Repositories\ProductManager;
use Modules\BookStore\Products\Book;
class BookStoreServiceProvider extends ServiceProvider
{
...
public function boot()
{
...
// Register Book
$this->app[ProductManager::class]->registerEntity(new Book());
...
}
}
LaraPlug is a opensource project to build e-commerce solution on top of AsgardCMS.
We welcome any pull-requests or issues :)