The fluent laravel marketplace

Overview

Latest Version on Packagist MadeWithLaravel.com shield

the marketplace CheatSheet will be availble soon


marketplace provides you the following :

1. Product & Product Variation System

Create simple products, and complex ones using variation system by attaching the product to a specific type.

2. Coupon System

Generate , Validate , and purchase them while checkout easily.

3. Wishlist / Cart System

  • CRUD the wishlist/cart easily
  • get the total/subtotal of the whole cart/wishlist and optionally after sale/coupons applied.
  • stock handling behind the scenes .

4. Category System

  • Attach product, type of products to a category.

5. Sale System

  • Setup sale for category, specific product, type of products.

6. Authorizing Users & Managing Roles.

Installation Steps

1. Require the Package

After creating your new Laravel application you can include the marketplace package with the following command:

composer require sectheater/marketplace:dev-master

2. Add the DB Credentials & APP_URL

Next make sure to create a new database and add your database credentials to your .env file:

DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

You will also want to update your website URL inside of the APP_URL variable inside the .env file:

APP_URL=http://localhost:8000

3. Getting Your Environment Ready.

Just Run The following command.

 php artisan sectheater-market:install     
 
Command Interpretation
  • The command just publishes the marketplace's config, migrations,helpers and seeder.

Notice : You may need to run the autoload composer command to reload the changes.

 composer dump-autoload -o 

Another Notice : Don't forget to delete the default users table migration, as marketplace ships with a default one as well.

4. Sample Usage

4.1 Creating a Product with Variation.
Product::generate([
  'user_id' => auth()->id(),
  'name' => 'laptop',
  'description' => 'Fancy laptop',
  'price' => 15000,
  'category' => 'electronics',
  'type' => ['name' => 'MacBook Pro', 'stock' => 20],
  'details' => ['color' => 'Silver', 'dummy-feature' => 'dummy-text']
);
4.2 Filter products by criteria.
Product::fetchByVariations(['locations' => 'U.K', 'variations' => ['size' => 'XL', 'color' => 'red'], 'categories' => 'clothes']);
  • Add custom Criterion and use it while searching.
4.3 get Cart total/subtotal.

Out of the blue, you may use a couple of methods to retrieve the total/subtotal

Cart::subtotal();
Cart::total(); // returns total after applying tax.
Cart::total($coupons); // Collection of coupons passed, returns total after applying tax and coupons.
Cart::subtotalAfterCoupon($coupons);

Suprisingly every single method you can use for a cart, you can use for a wishlist ( since we can consider it as a virtual cart )

4.4 get Cart item .
Cart::item(1); // get the item with id of 1

Cart::item(1,  ['color' => 'blue', 'size' => 'L']); // get the item with the id of 1 and should have these attributes.

Cart::item(null, ['color' => 'blue','size' => 'L']); // get the current authenticated user's cart which has these attributes assuming that these attributes identical to the database record.

Cart::item(null, ['color' => 'blue','size' => 'L'] , 'or');  // get the current authenticated user's cart which has any of these attributes.
4.4 Generate Coupons.
Coupon::generate([
  'user_id' => auth()->id(),
  'active' => true,
  'percentage' => 10.5,
  'expires_at' => Carbon::now()->addWeeks(3)->format('Y-m-d H:i:s')
]);
4.5 Validate Coupons.
$coupon = Coupon::first(); // valid one
Coupon::validate($coupon); // returns true
4.6 Deactivate Coupons.
$coupon = Coupon::first(); 
Coupon::deactivate($coupon->id);
4.7 Purchas Coupons.
$coupon = Coupon::first();
Coupon::purchase($coupon); // Purchase the coupon for the current authenticated user.
Coupon::purchase($coupon, $anotherUser); // Purchase the coupon for the passed user.
4.7 Purchased Coupons.
  • It releases the invalid purchased coupons automatically.
Coupon::purchased(); // returns the only valid purchased coupons.
4.8 Apply Specific Coupons.
  • Assuming the user has a couple of coupons, he can designate which of them that can be applied on a specific product.
Coupon::appliedCoupons($coupons); // returns a query builder.

For more, you can view the docs.

You might also like...
A package that uses blade templates to control how markdown is converted to HTML inside Laravel, as well as providing support for markdown files to Laravel views.
A package that uses blade templates to control how markdown is converted to HTML inside Laravel, as well as providing support for markdown files to Laravel views.

Install Install via composer. $ composer require olliecodes/laravel-etched-blade Once installed you'll want to publish the config. $ php artisan vendo

A light weight laravel package that facilitates dealing with arabic concepts using a set of classes and methods to make laravel speaks arabic

A light weight laravel package that facilitates dealing with arabic concepts using a set of classes and methods to make laravel speaks arabic! concepts like , Hijri Dates & Arabic strings and so on ..

Jetstrap is a lightweight laravel 8 package that focuses on the VIEW side of Jetstream / Breeze package installed in your Laravel application

A Laravel 8 package to easily switch TailwindCSS resources generated by Laravel Jetstream and Breeze to Bootstrap 4.

Laravel Jetstream is a beautifully designed application scaffolding for Laravel.

Laravel Jetstream is a beautifully designed application scaffolding for Laravel. Jetstream provides the perfect starting point for your next Laravel application and includes login, registration, email verification, two-factor authentication, session management, API support via Laravel Sanctum, and optional team management.

Laravel Larex lets you translate your whole Laravel application from a single CSV file.
Laravel Larex lets you translate your whole Laravel application from a single CSV file.

Laravel Larex Translate Laravel Apps from a CSV File Laravel Larex lets you translate your whole Laravel application from a single CSV file. You can i

A Laravel package that adds a simple image functionality to any Laravel model
A Laravel package that adds a simple image functionality to any Laravel model

Laraimage A Laravel package that adds a simple image functionality to any Laravel model Introduction Laraimage served four use cases when using images

A Laravel extension for using a laravel application on a multi domain setting
A Laravel extension for using a laravel application on a multi domain setting

Laravel Multi Domain An extension for using Laravel in a multi domain setting Description This package allows a single Laravel installation to work wi

Example of using abrouter/abrouter-laravel-bridge in Laravel
Example of using abrouter/abrouter-laravel-bridge in Laravel

ABRouter Laravel Example It's a example of using (ABRouter Laravel Client)[https://github.com/abrouter/abrouter-laravel-bridge] Set up locally First o

Laravel router extension to easily use Laravel's paginator without the query string

🚨 THIS PACKAGE HAS BEEN ABANDONED 🚨 We don't use this package anymore in our own projects and cannot justify the time needed to maintain it anymore.

Comments
  • Create LICENSE

    Create LICENSE

    IMPORTANT: Please do not create a Pull Request without creating an issue first.

    Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.

    Please provide enough information so that others can review your pull request:

    Explain the details for making this change. What existing problem does the pull request solve?

    Test plan (required)

    Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

    Code formatting

    Closing issues

    Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such).

    opened by SecTheater 0
  • Create CODE_OF_CONDUCT.md

    Create CODE_OF_CONDUCT.md

    IMPORTANT: Please do not create a Pull Request without creating an issue first.

    Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.

    Please provide enough information so that others can review your pull request:

    Explain the details for making this change. What existing problem does the pull request solve?

    Test plan (required)

    Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

    Code formatting

    Closing issues

    Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such).

    opened by SecTheater 0
Releases(v1.0.2)
Owner
Security Theater
Security Theater
Laravel Cashier Paddle provides an expressive, fluent interface to Paddle's subscription billing services.

Introduction Laravel Cashier Paddle provides an expressive, fluent interface to Paddle's subscription billing services. It handles almost all of the b

The Laravel Framework 189 Jan 5, 2023
A fluent Laravel package for Plaid

A fluent Laravel package for Plaid

Abivia 12 Sep 25, 2022
Object-oriented, composable, fluent API for writing validations in Laravel

Laravel Hyrule Hyrule provides an object-oriented, fluent API for building validation rules for use w/ Laravel's Validation component. This unlocks pa

Square 330 Dec 8, 2022
List of 77 languages for Laravel Framework 4, 5, 6, 7 and 8, Laravel Jetstream , Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova and Laravel Spark.

Laravel Lang In this repository, you can find the lang files for the Laravel Framework 4/5/6/7/8, Laravel Jetstream , Laravel Fortify, Laravel Cashier

Laravel Lang 6.9k Jan 2, 2023
⚡ Laravel Charts — Build charts using laravel. The laravel adapter for Chartisan.

What is laravel charts? Charts is a Laravel library used to create Charts using Chartisan. Chartisan does already have a PHP adapter. However, this li

Erik C. Forés 31 Dec 18, 2022
Laravel Kickstart is a Laravel starter configuration that helps you build Laravel websites faster.

Laravel Kickstart What is Laravel Kickstart? Laravel Kickstart is a Laravel starter configuration that helps you build Laravel websites faster. It com

Sam Rapaport 46 Oct 1, 2022
Laravel User Activity Log - a package for Laravel 8.x that provides easy to use features to log the activities of the users of your Laravel app

Laravel User Activity Log - a package for Laravel 8.x that provides easy to use features to log the activities of the users of your Laravel app

null 9 Dec 14, 2022
Laravel Segment is an opinionated, approach to integrating Segment into your Laravel application.

Laravel Segment Laravel Segment is an opinionated, approach to integrating Segment into your Laravel application. Installation You can install the pac

Octohook 13 May 16, 2022
Laravel Sanctum support for Laravel Lighthouse

Lighthouse Sanctum Add Laravel Sanctum support to Lighthouse Requirements Installation Usage Login Logout Register Email Verification Forgot Password

Daniël de Wit 43 Dec 21, 2022
Bring Laravel 8's cursor pagination to Laravel 6, 7

Laravel Cursor Paginate for laravel 6,7 Installation You can install the package via composer: composer require vanthao03596/laravel-cursor-paginate U

Pham Thao 9 Nov 10, 2022