Merged with Master

This commit is contained in:
prashant-webkul 2018-09-28 18:39:42 +05:30
commit 41fb4a6407
67 changed files with 1396 additions and 70 deletions

View File

@ -14,6 +14,7 @@
"intervention/image": "^2.4",
"intervention/imagecache": "^2.3",
"kalnoy/nestedset": "^4.3",
"konekt/concord": "^1.2",
"laravel/framework": "5.6.*",
"laravel/tinker": "^1.0",
"nwidart/laravel-modules": "^3.2",
@ -34,7 +35,7 @@
"webkul/laravel-ui": "self.version",
"webkul/laravel-core": "self.version",
"webkul/laravel-attribute": "self.version",
"webkul/laravel-cart": "self.version",
"webkul/laravel-checkout": "self.version",
"webkul/laravel-customer": "self.version",
"webkul/laravel-inventory": "self.version",
"webkul/laravel-category": "self.version",
@ -56,7 +57,7 @@
"Webkul\\Admin\\": "packages/Webkul/Admin/src",
"Webkul\\Ui\\": "packages/Webkul/Ui/src",
"Webkul\\Category\\": "packages/Webkul/Category/src",
"Webkul\\Cart\\": "packages/Webkul/Cart/src",
"Webkul\\Checkout\\": "packages/Webkul/Checkout/src",
"Webkul\\Attribute\\": "packages/Webkul/Attribute/src",
"Webkul\\Shop\\": "packages/Webkul/Shop/src",
"Webkul\\Core\\": "packages/Webkul/Core/src",

169
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "c0c2a23aa2502c590b2ccf7975329ce1",
"content-hash": "762c5c196d8a9a7814101fd53d60b1cf",
"packages": [
{
"name": "commerceguys/intl",
@ -922,6 +922,173 @@
],
"time": "2018-02-04T08:47:55+00:00"
},
{
"name": "konekt/concord",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/artkonekt/concord.git",
"reference": "7379f847fe1e90f9b71ce3f435dd9617ab8dfff5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/artkonekt/concord/zipball/7379f847fe1e90f9b71ce3f435dd9617ab8dfff5",
"reference": "7379f847fe1e90f9b71ce3f435dd9617ab8dfff5",
"shasum": ""
},
"require": {
"illuminate/console": "~5.4",
"illuminate/support": "~5.4",
"konekt/enum": "~2.1",
"konekt/enum-eloquent": "^1.1.3",
"php": ">=7.0.0"
},
"require-dev": {
"orchestra/testbench": "^3.4.2",
"phpunit/phpunit": "6.0 - 7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
},
"laravel": {
"providers": [
"Konekt\\Concord\\ConcordServiceProvider"
],
"aliases": {
"Concord": "Konekt\\Concord\\Facades\\Concord",
"Helper": "Konekt\\Concord\\Facades\\Helper"
}
}
},
"autoload": {
"psr-4": {
"Konekt\\Concord\\": "src"
},
"files": [
"src/Support/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Attila Fulop",
"homepage": "https://github.com/fulopattila122"
}
],
"description": "Concord is a Laravel Extension for building modular Laravel Applications",
"time": "2018-08-11T08:25:39+00:00"
},
{
"name": "konekt/enum",
"version": "2.1.1",
"source": {
"type": "git",
"url": "https://github.com/artkonekt/enum.git",
"reference": "ab37d89e1a6f88a76f25c6dd88b56b8892de86f2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/artkonekt/enum/zipball/ab37d89e1a6f88a76f25c6dd88b56b8892de86f2",
"reference": "ab37d89e1a6f88a76f25c6dd88b56b8892de86f2",
"shasum": ""
},
"require": {
"php": ">=7.0.0"
},
"require-dev": {
"phpunit/phpunit": "6.2 - 7.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"autoload": {
"psr-4": {
"Konekt\\Enum\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Attila Fulop",
"homepage": "https://github.com/fulopattila122"
}
],
"description": "SPL inspired PHP enum class implementation",
"keywords": [
"artkonekt",
"enum",
"konekt"
],
"time": "2018-06-09T13:03:01+00:00"
},
{
"name": "konekt/enum-eloquent",
"version": "1.1.3",
"source": {
"type": "git",
"url": "https://github.com/artkonekt/enum-eloquent.git",
"reference": "f67c981d549f69cddb9956ef51d16267c050a0c9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/artkonekt/enum-eloquent/zipball/f67c981d549f69cddb9956ef51d16267c050a0c9",
"reference": "f67c981d549f69cddb9956ef51d16267c050a0c9",
"shasum": ""
},
"require": {
"illuminate/database": "5.*",
"konekt/enum": "^2.0.2",
"php": ">=7.0.0"
},
"require-dev": {
"illuminate/events": "5.*",
"phpunit/phpunit": "~6.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"autoload": {
"psr-4": {
"Konekt\\Enum\\Eloquent\\": "src/"
},
"files": [
"src/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Attila Fulop",
"homepage": "https://github.com/fulopattila122"
}
],
"description": "Enum attribute casting for Eloquent models",
"keywords": [
"artkonekt",
"eloquent",
"enum",
"konekt",
"laravel"
],
"time": "2017-12-08T17:57:42+00:00"
},
{
"name": "laravel/framework",
"version": "v5.6.29",

View File

@ -175,6 +175,7 @@ return [
//Repository
Prettus\Repository\Providers\RepositoryServiceProvider::class,
Konekt\Concord\ConcordServiceProvider::class,
//Webkul packages
Webkul\User\Providers\UserServiceProvider::class,
@ -188,7 +189,7 @@ return [
Webkul\Inventory\Providers\InventoryServiceProvider::class,
Webkul\Product\Providers\ProductServiceProvider::class,
Webkul\Theme\Providers\ThemeServiceProvider::class,
Webkul\Cart\Providers\CartServiceProvider::class,
Webkul\Checkout\Providers\CartServiceProvider::class,
Webkul\Shipping\Providers\ShippingServiceProvider::class,
Webkul\Payment\Providers\PaymentServiceProvider::class,
Webkul\Sales\Providers\SalesServiceProvider::class,
@ -243,7 +244,7 @@ return [
'Datagrid' => Webkul\Ui\DataGrid\Facades\DataGrid::class,
'ProductGrid' => Webkul\Ui\DataGrid\Facades\ProductGrid::class,
'Image' => Intervention\Image\Facades\Image::class,
'Cart' => Webkul\Cart\Facades\Cart::class,
'Cart' => Webkul\Checkout\Facades\Cart::class,
'Core' => Webkul\Core\Facades\Core::class
],

View File

@ -1,13 +0,0 @@
<?php
namespace Webkul\Cart\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}

View File

@ -1,5 +1,5 @@
{
"name": "webkul/laravel-cart",
"name": "webkul/laravel-checkout",
"license": "MIT",
"authors": [
{
@ -10,13 +10,13 @@
"require": {},
"autoload": {
"psr-4": {
"Webkul\\Cart\\": "src/"
"Webkul\\Checkout\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Webkul\\Cart\\CartServiceProvider"
"Webkul\\Checkout\\CheckoutServiceProvider"
]
}
},

View File

@ -1,6 +1,6 @@
<?php
namespace Webkul\Cart\Facades;
namespace Webkul\Checkout\Facades;
use Illuminate\Support\Facades\Facade;

View File

@ -1,6 +1,6 @@
<?php
namespace Webkul\Cart\Http\Requests;
namespace Webkul\Checkout\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

View File

@ -1,6 +1,6 @@
<?php
namespace Webkul\Cart\Http\ViewComposers;
namespace Webkul\Checkout\Http\ViewComposers;
use Illuminate\View\View;
use Illuminate\Support\Collection;

View File

@ -1,5 +1,5 @@
<?php
use Webkul\Cart\Cart;
use Webkul\Checkout\Cart;
if (! function_exists('cart')) {
function cart()

View File

@ -1,13 +1,13 @@
<?php
namespace Webkul\Cart\Models;
namespace Webkul\Checkout\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Product\Models\Product;
use Webkul\Cart\Models\CartItem;
use Webkul\Cart\Models\CartAddress;
use Webkul\Cart\Models\CartPayment;
use Webkul\Cart\Models\CartShippingRate;
use Webkul\Checkout\Models\CartItem;
use Webkul\Checkout\Models\CartAddress;
use Webkul\Checkout\Models\CartPayment;
use Webkul\Checkout\Models\CartShippingRate;
class Cart extends Model
{
@ -42,7 +42,7 @@ class Cart extends Model
}
/**
* Get all of the attributes for the attribute groups.
* Get billing address for the cart.
*/
public function getBillingAddressAttribute()
{
@ -58,7 +58,7 @@ class Cart extends Model
}
/**
* Get all of the attributes for the attribute groups.
* Get shipping address for the cart.
*/
public function getShippingAddressAttribute()
{

View File

@ -1,9 +1,9 @@
<?php
namespace Webkul\Cart\Models;
namespace Webkul\Checkout\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Cart\Models\CartShippingRate;
use Webkul\Checkout\Models\CartShippingRate;
class CartAddress extends Model
{

View File

@ -1,6 +1,6 @@
<?php
namespace Webkul\Cart\Models;
namespace Webkul\Checkout\Models;
use Illuminate\Database\Eloquent\Model;

View File

@ -1,6 +1,6 @@
<?php
namespace Webkul\Cart\Models;
namespace Webkul\Checkout\Models;
use Illuminate\Database\Eloquent\Model;

View File

@ -1,9 +1,9 @@
<?php
namespace Webkul\Cart\Models;
namespace Webkul\Checkout\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Cart\Models\CartAddress;
use Webkul\Checkout\Models\CartAddress;
class CartShippingRate extends Model
{

View File

@ -1,6 +1,6 @@
<?php
namespace Webkul\Cart\Providers;
namespace Webkul\Checkout\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Validator;
@ -8,8 +8,8 @@ use Illuminate\Routing\Router;
use Illuminate\Foundation\AliasLoader;
use Webkul\User\Http\Middleware\RedirectIfNotAdmin;
use Webkul\Customer\Http\Middleware\RedirectIfNotCustomer;
use Webkul\Cart\Facades\Cart;
use Webkul\Cart\Providers\ComposerServiceProvider;
use Webkul\Checkout\Facades\Cart;
use Webkul\Checkout\Providers\ComposerServiceProvider;
class CartServiceProvider extends ServiceProvider
{
@ -55,6 +55,6 @@ class CartServiceProvider extends ServiceProvider
return new cart();
});
$this->app->bind('cart', 'Webkul\Cart\Cart');
$this->app->bind('cart', 'Webkul\Checkout\Cart');
}
}

View File

@ -1,6 +1,6 @@
<?php
namespace Webkul\Cart\Providers;
namespace Webkul\Checkout\Providers;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Blade;
@ -17,7 +17,7 @@ class ComposerServiceProvider extends ServiceProvider
public function boot()
{
//using the class based composers...
View::composer(['shop::layouts.header.index'], 'Webkul\Cart\Http\ViewComposers\CartComposer');
View::composer(['shop::layouts.header.index'], 'Webkul\Checkout\Http\ViewComposers\CartComposer');
}
/**

View File

@ -1,6 +1,6 @@
<?php
namespace Webkul\Cart\Repositories;
namespace Webkul\Checkout\Repositories;
use Webkul\Core\Eloquent\Repository;
@ -20,6 +20,6 @@ class CartAddressRepository extends Repository
*/
function model()
{
return 'Webkul\Cart\Models\CartAddress';
return 'Webkul\Checkout\Models\CartAddress';
}
}

View File

@ -1,6 +1,6 @@
<?php
namespace Webkul\Cart\Repositories;
namespace Webkul\Checkout\Repositories;
use Webkul\Core\Eloquent\Repository;
@ -21,7 +21,7 @@ class CartItemRepository extends Repository
function model()
{
return 'Webkul\Cart\Models\CartItem';
return 'Webkul\Checkout\Models\CartItem';
}
/**

View File

@ -1,6 +1,6 @@
<?php
namespace Webkul\Cart\Repositories;
namespace Webkul\Checkout\Repositories;
use Webkul\Core\Eloquent\Repository;
@ -21,7 +21,7 @@ class CartRepository extends Repository
function model()
{
return 'Webkul\Cart\Models\Cart';
return 'Webkul\Checkout\Models\Cart';
}
/**

View File

@ -7,7 +7,9 @@
"email": "jitendra@webkul.com"
}
],
"require": {},
"require": {
"konekt/concord": "^1.2"
},
"autoload": {
"psr-4": {
"Webkul\\Sales\\": "src/"

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Sales\Contracts;
interface Invoice
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Sales\Contracts;
interface InvoiceItem
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Sales\Contracts;
interface Order
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Sales\Contracts;
interface OrderAddress
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Sales\Contracts;
interface OrderItem
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Sales\Contracts;
interface Shipment
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Sales\Contracts;
interface ShipmentItem
{
}

View File

@ -0,0 +1,92 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateOrdersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('orders', function (Blueprint $table) {
$table->increments('id');
$table->string('increment_id');
$table->boolean('is_guest')->nullable();
$table->string('customer_email')->nullable();
$table->string('customer_first_name')->nullable();
$table->string('customer_last_name')->nullable();
$table->string('shipping_method')->nullable();
$table->string('shipping_description')->nullable();
$table->string('coupon_code')->nullable();
$table->boolean('is_gift')->default(0);
$table->integer('total_item_count')->nullable();
$table->integer('total_qty_ordered')->nullable();
$table->string('base_currency_code')->nullable();
$table->string('channel_currency_code')->nullable();
$table->string('order_currency_code')->nullable();
$table->decimal('grand_total', 12, 4)->default(0)->nullable();
$table->decimal('base_grand_total', 12, 4)->default(0)->nullable();
$table->decimal('grand_total_invoiced', 12, 4)->default(0)->nullable();
$table->decimal('base_grand_total_invoiced', 12, 4)->default(0)->nullable();
$table->decimal('grand_total_refunded', 12, 4)->default(0)->nullable();
$table->decimal('base_grand_total_refunded', 12, 4)->default(0)->nullable();
$table->decimal('sub_total', 12, 4)->default(0)->nullable();
$table->decimal('base_sub_total', 12, 4)->default(0)->nullable();
$table->decimal('sub_total_invoiced', 12, 4)->default(0)->nullable();
$table->decimal('base_sub_total_invoiced', 12, 4)->default(0)->nullable();
$table->decimal('sub_total_refunded', 12, 4)->default(0)->nullable();
$table->decimal('base_sub_total_refunded', 12, 4)->default(0)->nullable();
$table->decimal('discount_percent', 12, 4)->default(0)->nullable();
$table->decimal('discount_amount', 12, 4)->default(0)->nullable();
$table->decimal('base_discount_amount', 12, 4)->default(0)->nullable();
$table->decimal('discount_invoiced', 12, 4)->default(0)->nullable();
$table->decimal('base_discount_invoiced', 12, 4)->default(0)->nullable();
$table->decimal('discount_refunded', 12, 4)->default(0)->nullable();
$table->decimal('base_discount_refunded', 12, 4)->default(0)->nullable();
$table->decimal('tax_amount', 12, 4)->default(0)->nullable();
$table->decimal('base_tax_amount', 12, 4)->default(0)->nullable();
$table->decimal('tax_amount_invoiced', 12, 4)->default(0)->nullable();
$table->decimal('base_tax_amount_invoiced', 12, 4)->default(0)->nullable();
$table->decimal('tax_amount_refunded', 12, 4)->default(0)->nullable();
$table->decimal('base_tax_amount_refunded', 12, 4)->default(0)->nullable();
$table->decimal('shipping_amount', 12, 4)->default(0)->nullable();
$table->decimal('base_shipping_amount', 12, 4)->default(0)->nullable();
$table->decimal('shipping_invoiced', 12, 4)->default(0)->nullable();
$table->decimal('base_shipping_invoiced', 12, 4)->default(0)->nullable();
$table->decimal('shipping_refunded', 12, 4)->default(0)->nullable();
$table->decimal('base_shipping_refunded', 12, 4)->default(0)->nullable();
$table->integer('customer_id')->unsigned()->nullable();
$table->string('customer_type')->nullable();
$table->foreign('customer_id')->references('id')->on('customers')->onDelete('set null');
$table->integer('channel_id')->unsigned()->nullable();
$table->string('channel_type')->nullable();
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('set null');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('orders');
}
}

View File

@ -0,0 +1,78 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateOrderItemsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('order_items', function (Blueprint $table) {
$table->increments('id');
$table->string('sku')->nullable();
$table->string('type')->nullable();
$table->string('name')->nullable();
$table->string('coupon_code')->nullable();
$table->decimal('weight', 12,4)->default(0)->nullable();
$table->decimal('total_weight', 12,4)->default(0)->nullable();
$table->integer('qty_ordered')->default(0)->nullable();
$table->integer('qty_shipped')->default(0)->nullable();
$table->integer('qty_invoiced')->default(0)->nullable();
$table->integer('qty_refunded')->default(0)->nullable();
$table->decimal('price', 12,4)->default(0);
$table->decimal('base_price', 12,4)->default(0);
$table->decimal('total', 12,4)->default(0);
$table->decimal('base_total', 12,4)->default(0);
$table->decimal('total_invoiced', 12,4)->default(0);
$table->decimal('base_total_invoiced', 12,4)->default(0);
$table->decimal('amount_refunded', 12,4)->default(0);
$table->decimal('base_amount_refunded', 12,4)->default(0);
$table->decimal('discount_percent', 12, 4)->default(0)->nullable();
$table->decimal('discount_amount', 12, 4)->default(0)->nullable();
$table->decimal('base_discount_amount', 12, 4)->default(0)->nullable();
$table->decimal('discount_invoiced', 12, 4)->default(0)->nullable();
$table->decimal('base_discount_invoiced', 12, 4)->default(0)->nullable();
$table->decimal('discount_refunded', 12, 4)->default(0)->nullable();
$table->decimal('base_discount_refunded', 12, 4)->default(0)->nullable();
$table->decimal('tax_percent', 12, 4)->default(0)->nullable();
$table->decimal('tax_amount', 12, 4)->default(0)->nullable();
$table->decimal('base_tax_amount', 12, 4)->default(0)->nullable();
$table->decimal('tax_amount_invoiced', 12, 4)->default(0)->nullable();
$table->decimal('base_tax_amount_invoiced', 12, 4)->default(0)->nullable();
$table->decimal('tax_amount_refunded', 12, 4)->default(0)->nullable();
$table->decimal('base_tax_amount_refunded', 12, 4)->default(0)->nullable();
$table->integer('product_id')->unsigned()->nullable();
$table->string('product_type')->nullable();
$table->integer('order_id')->unsigned()->nullable();
$table->foreign('order_id')->references('id')->on('orders')->onDelete('cascade');
$table->integer('parent_id')->unsigned()->nullable();
$table->foreign('parent_id')->references('id')->on('order_items')->onDelete('cascade');
$table->json('additional')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('order_items');
}
}

View File

@ -0,0 +1,46 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateOrderAddressTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('order_address', function (Blueprint $table) {
$table->increments('id');
$table->string('first_name');
$table->string('last_name');
$table->string('email');
$table->string('address1');
$table->string('address2')->nullable();
$table->string('country');
$table->string('state');
$table->string('city');
$table->integer('postcode');
$table->string('phone');
$table->string('address_type');
$table->integer('order_id')->unsigned();
$table->foreign('order_id')->references('id')->on('orders')->onDelete('cascade');
$table->integer('customer_id')->unsigned()->nullable();
$table->foreign('customer_id')->references('id')->on('customers')->onDelete('set null');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('order_address');
}
}

View File

@ -0,0 +1,46 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateShipmentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('shipments', function (Blueprint $table) {
$table->increments('id');
$table->string('status')->nullable();
$table->integer('total_qty')->nullable();
$table->integer('total_weight')->nullable();
$table->string('carrier_code')->nullable();
$table->string('carrier_title')->nullable();
$table->text('track_number')->nullable();
$table->boolean('email_sent')->default(0);
$table->integer('customer_id')->unsigned()->nullable();
$table->string('customer_type')->nullable();
$table->integer('order_id')->unsigned();
$table->foreign('order_id')->references('id')->on('orders')->onDelete('cascade');
$table->integer('order_address_id')->unsigned()->nullable();
$table->foreign('order_address_id')->references('id')->on('order_address')->onDelete('set null');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('shipments');
}
}

View File

@ -0,0 +1,50 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateShipmentItemsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('shipment_items', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->nullable();
$table->string('description')->nullable();
$table->string('sku')->nullable();
$table->integer('qty')->nullable();
$table->integer('weight')->nullable();
$table->decimal('price', 12, 4)->default(0)->nullable();
$table->decimal('base_price', 12, 4)->default(0)->nullable();
$table->decimal('base_total', 12, 4)->default(0)->nullable();
$table->integer('product_id')->unsigned()->nullable();
$table->string('product_type')->nullable();
$table->integer('order_item_id')->unsigned()->nullable();
$table->integer('shipment_id')->unsigned();
$table->foreign('shipment_id')->references('id')->on('shipments')->onDelete('cascade');
$table->integer('parent_id')->unsigned()->nullable();
$table->foreign('parent_id')->references('id')->on('shipment_items')->onDelete('cascade');
$table->json('additional')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('shipment_items');
}
}

View File

@ -0,0 +1,68 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateInvoicesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('invoices', function (Blueprint $table) {
$table->increments('id');
$table->string('increment_id');
$table->string('state')->nullable();
$table->boolean('email_sent')->default(0);
$table->string('shipping_method')->nullable();
$table->string('shipping_description')->nullable();
$table->string('coupon_code')->nullable();
$table->boolean('is_gift')->default(0);
$table->integer('total_item_count')->nullable();
$table->integer('total_qty_ordered')->nullable();
$table->string('base_currency_code')->nullable();
$table->string('channel_currency_code')->nullable();
$table->string('order_currency_code')->nullable();
$table->decimal('sub_total', 12, 4)->default(0)->nullable();
$table->decimal('base_sub_total', 12, 4)->default(0)->nullable();
$table->decimal('grand_total', 12, 4)->default(0)->nullable();
$table->decimal('base_grand_total', 12, 4)->default(0)->nullable();
$table->decimal('shipping_amount', 12, 4)->default(0)->nullable();
$table->decimal('base_shipping_amount', 12, 4)->default(0)->nullable();
$table->decimal('tax_amount', 12, 4)->default(0)->nullable();
$table->decimal('base_tax_amount', 12, 4)->default(0)->nullable();
$table->decimal('discount_amount', 12, 4)->default(0)->nullable();
$table->decimal('base_discount_amount', 12, 4)->default(0)->nullable();
$table->integer('customer_id')->unsigned()->nullable();
$table->string('customer_type')->nullable();
$table->integer('channel_id')->unsigned()->nullable();
$table->string('channel_type')->nullable();
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('set null');
$table->integer('order_address_id')->unsigned()->nullable();
$table->foreign('order_address_id')->references('id')->on('order_address')->onDelete('set null');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('invoices');
}
}

View File

@ -0,0 +1,54 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateInvoiceItemsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('invoice_items', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->nullable();
$table->string('description')->nullable();
$table->string('sku')->nullable();
$table->integer('qty')->nullable();
$table->decimal('price', 12,4)->default(0);
$table->decimal('base_price', 12,4)->default(0);
$table->decimal('total', 12,4)->default(0);
$table->decimal('base_total', 12,4)->default(0);
$table->decimal('tax_amount', 12,4)->default(0)->nullable();
$table->decimal('base_tax_amount', 12,4)->default(0)->nullable();
$table->integer('product_id')->unsigned()->nullable();
$table->string('product_type')->nullable();
$table->integer('order_item_id')->unsigned()->nullable();
$table->integer('invoice_id')->unsigned()->nullable();
$table->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade');
$table->integer('parent_id')->unsigned()->nullable();
$table->foreign('parent_id')->references('id')->on('shipment_items')->onDelete('cascade');
$table->json('additional')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('invoice_items');
}
}

View File

@ -0,0 +1,72 @@
<?php
namespace Webkul\Sales\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Sales\Contracts\Invoice as InvoiceContract;
class Invoice extends Model implements InvoiceContract
{
/**
* Get the invoice items record associated with the invoice.
*/
public function items() {
return $this->hasMany(InvoiceItemProxy::modelClass())->whereNull('parent_id');
}
/**
* Get the customer record associated with the invoice.
*/
public function customer()
{
return $this->morphTo();
}
/**
* Get the channel record associated with the invoice.
*/
public function channel()
{
return $this->morphTo();
}
/**
* Get the addresses for the invoice.
*/
public function addresses()
{
return $this->hasMany(OrderAddressProxy::modelClass());
}
/**
* Get the biling address for the invoice.
*/
public function billing_address()
{
return $this->addresses()->where('address_type', 'billing');
}
/**
* Get billing address for the invoice.
*/
public function getBillingAddressAttribute()
{
return $this->billing_address()->first();
}
/**
* Get the shipping address for the invoice.
*/
public function shipping_address()
{
return $this->addresses()->where('address_type', 'shipping');
}
/**
* Get shipping address for the invoice.
*/
public function getShippingAddressAttribute()
{
return $this->shipping_address()->first();
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace Webkul\Sales\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Sales\Contracts\InvoiceItem as InvoiceItemContract;
class InvoiceItem extends Model implements InvoiceItemContract
{
/**
* Get the invoice record associated with the invoice item.
*/
public function invoice()
{
return $this->belongsTo(InvoiceProxy::modelClass());
}
/**
* Get the order item record associated with the invoice item.
*/
public function order_item()
{
return $this->belongsTo(OrderItemProxy::modelClass());
}
/**
* Get the invoice record associated with the invoice item.
*/
public function product()
{
return $this->morphTo();
}
/**
* Get the child item record associated with the invoice item.
*/
public function child()
{
return $this->belongsTo(InvoiceItemProxy::modelClass(), 'parent_id');
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Sales\Models;
use Konekt\Concord\Proxies\ModelProxy;
class InvoiceItemProxy extends ModelProxy
{
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Sales\Models;
use Konekt\Concord\Proxies\ModelProxy;
class InvoiceProxy extends ModelProxy
{
}

View File

@ -0,0 +1,88 @@
<?php
namespace Webkul\Sales\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Sales\Contracts\Order as OrderContract;
class Order extends Model implements OrderContract
{
protected $guarded = ['id', 'created_at', 'updated_at'];
/**
* Get the order items record associated with the order.
*/
public function items() {
return $this->hasMany(CartItemProxy::modelClass())->whereNull('parent_id');
}
/**
* Get the order shipments record associated with the order.
*/
public function shipments() {
return $this->hasMany(ShipmentProxy::modelClass());
}
/**
* Get the order invoices record associated with the order.
*/
public function invoices() {
return $this->hasMany(InvoiceProxy::modelClass());
}
/**
* Get the customer record associated with the order.
*/
public function customer()
{
return $this->morphTo();
}
/**
* Get the addresses for the order.
*/
public function addresses()
{
return $this->hasMany(OrderAddressProxy::modelClass());
}
/**
* Get the biling address for the order.
*/
public function billing_address()
{
return $this->addresses()->where('address_type', 'billing');
}
/**
* Get billing address for the order.
*/
public function getBillingAddressAttribute()
{
return $this->billing_address()->first();
}
/**
* Get the shipping address for the order.
*/
public function shipping_address()
{
return $this->addresses()->where('address_type', 'shipping');
}
/**
* Get shipping address for the order.
*/
public function getShippingAddressAttribute()
{
return $this->shipping_address()->first();
}
/**
* Get the channel record associated with the order.
*/
public function channel()
{
return $this->morphTo();
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace Webkul\Sales\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Sales\Contracts\OrderAddress as OrderAddressContract;
use Webkul\Customer\Models\Customer;
class OrderAddress extends Model implements OrderAddressContract
{
protected $table = 'order_address';
/**
* Get of the customer fullname.
*/
public function getNameAttribute()
{
return $this->first_name . ' ' . $this->last_name;
}
/**
* Get the customer record associated with the order.
*/
public function customer()
{
return $this->belongsTo(Customer::class);
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Sales\Models;
use Konekt\Concord\Proxies\ModelProxy;
class OrderAddressProxy extends ModelProxy
{
}

View File

@ -0,0 +1,33 @@
<?php
namespace Webkul\Sales\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Sales\Contracts\OrderItem as OrderItemContract;
class OrderItem extends Model implements OrderItemContract
{
/**
* Get the order record associated with the order item.
*/
public function order()
{
return $this->belongsTo(OrderProxy::modelClass());
}
/**
* Get the order record associated with the order item.
*/
public function product()
{
return $this->morphTo();
}
/**
* Get the child item record associated with the order item.
*/
public function child()
{
return $this->belongsTo(OrderItemProxy::modelClass(), 'parent_id');
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Sales\Models;
use Konekt\Concord\Proxies\ModelProxy;
class OrderItemProxy extends ModelProxy
{
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Sales\Models;
use Konekt\Concord\Proxies\ModelProxy;
class OrderProxy extends ModelProxy
{
}

View File

@ -0,0 +1,64 @@
<?php
namespace Webkul\Sales\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Sales\Contracts\Shipment as ShipmentContract;
class Shipment extends Model implements ShipmentContract
{
/**
* Get the shipment items record associated with the shipment.
*/
public function items() {
return $this->hasMany(ShipmentItemProxy::modelClass())->whereNull('parent_id');
}
/**
* Get the customer record associated with the shipment.
*/
public function customer()
{
return $this->morphTo();
}
/**
* Get the addresses for the shipment.
*/
public function addresses()
{
return $this->hasMany(OrderAddressProxy::modelClass());
}
/**
* Get the biling address for the shipment.
*/
public function billing_address()
{
return $this->addresses()->where('address_type', 'billing');
}
/**
* Get billing address for the shipment.
*/
public function getBillingAddressAttribute()
{
return $this->billing_address()->first();
}
/**
* Get the shipping address for the shipment.
*/
public function shipping_address()
{
return $this->addresses()->where('address_type', 'shipping');
}
/**
* Get shipping address for the shipment.
*/
public function getShippingAddressAttribute()
{
return $this->shipping_address()->first();
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace Webkul\Sales\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Sales\Contracts\ShipmentItem as ShipmentItemContract;
class ShipmentItem extends Model implements ShipmentItemContract
{
/**
* Get the shipment record associated with the shipment item.
*/
public function shipment()
{
return $this->belongsTo(ShipmentProxy::modelClass());
}
/**
* Get the order item record associated with the shipment item.
*/
public function order_item()
{
return $this->belongsTo(OrderItemProxy::modelClass());
}
/**
* Get the shipment record associated with the shipment item.
*/
public function product()
{
return $this->morphTo();
}
/**
* Get the child item record associated with the shipment item.
*/
public function child()
{
return $this->belongsTo(ShipmentItemProxy::modelClass(), 'parent_id');
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Sales\Models;
use Konekt\Concord\Proxies\ModelProxy;
class ShipmentItemProxy extends ModelProxy
{
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Sales\Models;
use Konekt\Concord\Proxies\ModelProxy;
class ShipmentProxy extends ModelProxy
{
}

View File

@ -0,0 +1,18 @@
<?php
namespace Webkul\Sales\Providers;
use Konekt\Concord\BaseModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
{
protected $models = [
\Webkul\Sales\Models\OrderAddress::class,
\Webkul\Sales\Models\Order::class,
\Webkul\Sales\Models\OrderItem::class,
\Webkul\Sales\Models\Invoice::class,
\Webkul\Sales\Models\InvoiceItem::class,
\Webkul\Sales\Models\Shipment::class,
\Webkul\Sales\Models\ShipmentItem::class,
];
}

View File

@ -3,16 +3,16 @@
namespace Webkul\Sales\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Validator;
use Illuminate\Routing\Router;
use Illuminate\Foundation\AliasLoader;
use Webkul\Sales\Providers\ModuleServiceProvider;
class SalesServiceProvider extends ServiceProvider
{
public function boot(Router $router)
{
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->app->register(ModuleServiceProvider::class);
}
/**

View File

@ -0,0 +1,27 @@
<?php
namespace Webkul\Sales\Repositories;
use Illuminate\Container\Container as App;
use Webkul\Core\Eloquent\Repository;
/**
* Invoice Item Reposotory
*
* @author Jitendra Singh <jitendra@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class InvoiceItemRepository extends Repository
{
/**
* Specify Model class name
*
* @return Mixed
*/
function model()
{
return 'Webkul\Sales\Contracts\InvoiceItem';
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Webkul\Sales\Repositories;
use Illuminate\Container\Container as App;
use Webkul\Core\Eloquent\Repository;
/**
* Invoice Reposotory
*
* @author Jitendra Singh <jitendra@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class InvoiceRepository extends Repository
{
/**
* Specify Model class name
*
* @return Mixed
*/
function model()
{
return 'Webkul\Sales\Contracts\Invoice';
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Webkul\Sales\Repositories;
use Illuminate\Container\Container as App;
use Webkul\Core\Eloquent\Repository;
/**
* Order Address Reposotory
*
* @author Jitendra Singh <jitendra@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class OrderAddressRepository extends Repository
{
/**
* Specify Model class name
*
* @return Mixed
*/
function model()
{
return 'Webkul\Sales\Contracts\OrderAddress';
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Webkul\Sales\Repositories;
use Illuminate\Container\Container as App;
use Webkul\Core\Eloquent\Repository;
/**
* OrderItem Reposotory
*
* @author Jitendra Singh <jitendra@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class OrderItemRepository extends Repository
{
/**
* Specify Model class name
*
* @return Mixed
*/
function model()
{
return 'Webkul\Sales\Contracts\OrderItem';
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace Webkul\Sales\Repositories;
use Illuminate\Container\Container as App;
use Webkul\Core\Eloquent\Repository;
/**
* Order Reposotory
*
* @author Jitendra Singh <jitendra@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class OrderRepository extends Repository
{
/**
* OrderItemRepository object
*
* @var Object
*/
protected $orderItem;
/**
* Create a new repository instance.
*
* @param Webkul\Sales\Repositories\OrderItemRepository $orderItem
* @return void
*/
public function __construct(
OrderItemRepository $orderItem,
App $app
)
{
$this->orderItem = $orderItem;
parent::__construct($app);
}
/**
* Specify Model class name
*
* @return Mixed
*/
function model()
{
return 'Webkul\Sales\Contracts\Order';
}
/**
* @param array $data
* @return mixed
*/
public function create(array $data)
{
$order = $this->find(2);
dd($order->customer);
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Webkul\Sales\Repositories;
use Illuminate\Container\Container as App;
use Webkul\Core\Eloquent\Repository;
/**
* Shipment Reposotory
*
* @author Jitendra Singh <jitendra@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class ShipmentRepository extends Repository
{
/**
* Specify Model class name
*
* @return Mixed
*/
function model()
{
return 'Webkul\Sales\Contracts\Shipment';
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Webkul\Sales\Repositories;
use Illuminate\Container\Container as App;
use Webkul\Core\Eloquent\Repository;
/**
* ShipmentItem Reposotory
*
* @author Jitendra Singh <jitendra@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class ShipmentItemRepository extends Repository
{
/**
* Specify Model class name
*
* @return Mixed
*/
function model()
{
return 'Webkul\Sales\Contracts\ShipmentItem';
}
}

View File

@ -1,6 +1,6 @@
<?php
namespace Webkul\Cart\Http\Controllers;
namespace Webkul\Shop\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@ -11,13 +11,12 @@ use Webkul\Payment\Facades\Payment;
use Webkul\Cart\Http\Requests\CustomerAddressForm;
/**
* Chekout controller for the customer
* and guest for placing order
* Chekout controller for the customer and guest for placing order
*
* @author Jitendra Singh <jitendra@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CheckoutController extends Controller
class OnepageController extends Controller
{
/**
* Contains route related configuration

View File

@ -10,37 +10,45 @@ Route::group(['middleware' => ['web']], function () {
'view' => 'shop::products.index'
]);
Route::get('/checkout/onepage', 'Webkul\Cart\Http\Controllers\CheckoutController@index')->defaults('_config', [
Route::get('/checkout/cart', 'Webkul\Shop\Http\Controllers\CartController@index')->defaults('_config', [
'view' => 'shop::checkout.cart.index'
])->name('shop.checkout.cart.index');
Route::get('/checkout/onepage', 'Webkul\Shop\Http\Controllers\OnepageController@index')->defaults('_config', [
'view' => 'shop::checkout.onepage'
])->name('shop.checkout.onepage.index');
Route::post('/checkout/save-address', 'Webkul\Cart\Http\Controllers\CheckoutController@saveAddress')->name('shop.checkout.save-address');
Route::post('/checkout/save-address', 'Webkul\Shop\Http\Controllers\CheckoutController@saveAddress')->name('shop.checkout.save-address');
Route::post('/checkout/save-shipping', 'Webkul\Cart\Http\Controllers\CheckoutController@saveShipping')->name('shop.checkout.save-shipping');
Route::post('/checkout/save-shipping', 'Webkul\Shop\Http\Controllers\CheckoutController@saveShipping')->name('shop.checkout.save-shipping');
Route::post('/checkout/save-payment', 'Webkul\Cart\Http\Controllers\CheckoutController@savePayment')->name('shop.checkout.save-payment');
Route::post('/checkout/save-payment', 'Webkul\Shop\Http\Controllers\CheckoutController@savePayment')->name('shop.checkout.save-payment');
Route::get('test', 'Webkul\Shop\Http\Controllers\CartController@test');
Route::get('mtest', 'Webkul\Shop\Http\Controllers\CartController@mergeTest');
//dummy
Route::get('test', 'Webkul\Cart\Http\Controllers\CartController@test');
Route::get('test', 'Webkul\Shop\Http\Controllers\CartController@test');
Route::get('/products/{slug}', 'Webkul\Shop\Http\Controllers\ProductController@index')->defaults('_config', [
'view' => 'shop::products.view'
])->name('shop.products.index');
// //Routes for product cart
Route::get('/checkout/cart', 'Webkul\Cart\Http\Controllers\CartController@index')->defaults('_config', [
'view' => 'shop::checkout.cart.index'
])->name('shop.checkout.cart.index');
// Route::get('/checkout/cart', 'Webkul\Shop\Http\Controllers\CartController@index')->defaults('_config', [
// 'view' => 'shop::checkout.cart.index'
// ])->name('shop.checkout.cart.index');
Route::post('product/cart/add/{id}', 'Webkul\Cart\Http\Controllers\CartController@add')->name('cart.add');
Route::post('product/cart/add/{id}', 'Webkul\Shop\Http\Controllers\CartController@add')->name('cart.add');
Route::get('product/cart/remove/{id}', 'Webkul\Cart\Http\Controllers\CartController@remove')->name('cart.remove');
Route::get('product/cart/remove/{id}', 'Webkul\Shop\Http\Controllers\CartController@remove')->name('cart.remove');
Route::post('/checkout/cart', 'Webkul\Cart\Http\Controllers\CartController@updateBeforeCheckout')->defaults('_config',[
Route::post('/checkout/cart', 'Webkul\Shop\Http\Controllers\CartController@updateBeforeCheckout')->defaults('_config',[
'redirect' => 'shop.checkout.cart.index'
])->name('shop.checkout.cart.update');
Route::get('/checkout/cart/remove/{id}', 'Webkul\Cart\Http\Controllers\CartController@remove')->defaults('_config',[
Route::get('/checkout/cart/remove/{id}', 'Webkul\Shop\Http\Controllers\CartController@remove')->defaults('_config',[
'redirect' => 'shop.checkout.cart.index'
])->name('shop.checkout.cart.remove');
//Routes for product cart ends